Skip to content

Commit 0f4ebb0

Browse files
Merge pull request #266316 from cdpark/howto-launch-reader
User Story 201187: Q&M: Freshness pass for Immersive Reader -- How to launch reader
2 parents d940822 + 025e9bf commit 0f4ebb0

13 files changed

+125
-125
lines changed

articles/ai-services/immersive-reader/how-to-launch-immersive-reader.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
22
title: "How to launch the Immersive Reader"
33
titleSuffix: Azure AI services
4-
description: Learn how to launch the Immersive reader using JavaScript, Python, Android, or iOS. Immersive Reader uses proven techniques to improve reading comprehension for language learners, emerging readers, and students with learning differences.
5-
author: rwallerms
4+
description: Learn how to launch the Immersive reader using JavaScript, Python, Android, or iOS.
5+
author: sharmas
66
manager: nitinme
77
ms.service: azure-ai-immersive-reader
88
ms.topic: how-to
9-
ms.date: 03/04/2021
10-
ms.author: rwaller
9+
ms.date: 02/21/2024
10+
ms.author: sharmas
1111
ms.custom: devx-track-js, devx-track-extended-java, devx-track-python
1212
zone_pivot_groups: immersive-reader-how-to-guides
1313
---
1414

1515
# How to launch the Immersive Reader
1616

17-
In the [overview](./overview.md), you learned about what the Immersive Reader is and how it implements proven techniques to improve reading comprehension for language learners, emerging readers, and students with learning differences. This article demonstrates how to launch the Immersive Reader JavaScript, Python, Android, or iOS.
17+
In the [overview](./overview.md), you learned about the Immersive Reader and how it implements proven techniques to improve reading comprehension for language learners, emerging readers, and students with learning differences. This article demonstrates how to launch the Immersive Reader using JavaScript, Python, Android, or iOS.
1818

1919
::: zone pivot="programming-language-javascript"
2020

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
11
---
2-
author: rwallerms
2+
author: sharmas
33
manager: nitinme
44
ms.service: azure-ai-immersive-reader
55
ms.topic: include
6-
ms.date: 03/04/2021
7-
ms.author: rwaller
6+
ms.date: 02/21/2024
7+
ms.author: sharmas
88
---
99

1010
## Prerequisites
1111

12-
* Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services)
13-
* An Immersive Reader resource configured for Microsoft Entra authentication. Follow [these instructions](../../how-to-create-immersive-reader.md) to get set up. You will need some of the values created here when configuring the environment properties. Save the output of your session into a text file for future reference.
14-
* [Git](https://git-scm.com/).
15-
* [Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk).
12+
* An Azure subscription. You can [create one for free](https://azure.microsoft.com/free/ai-services).
13+
* An Immersive Reader resource configured for Microsoft Entra authentication. Follow [these instructions](../../how-to-create-immersive-reader.md) to get set up. Save the output of your session into a text file so you can configure the environment properties.
14+
* [Git](https://git-scm.com).
15+
* Clone the [Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk) from GitHub.
1616
* [Android Studio](https://developer.android.com/studio).
1717

1818
## Configure authentication credentials
1919

20-
1. Start Android Studio, and open the project from the **immersive-reader-sdk/js/samples/quickstart-java-android** directory (Java) or the **immersive-reader-sdk/js/samples/quickstart-kotlin** directory (Kotlin).
20+
1. Start Android Studio, and open the Immersive Reader SDK project from the *immersive-reader-sdk/js/samples/quickstart-java-android* directory (Java) or the *immersive-reader-sdk/js/samples/quickstart-kotlin* directory (Kotlin).
2121

22-
1. Create a file named **env** inside the **/assets** folder. Add the following names and values, and supply values as appropriate. Don't commit this file into source control because it contains secrets that shouldn't be made public.
22+
> [!TIP]
23+
> You might need to let the system update the Gradle plugins to at least version 8.
24+
25+
1. To create a new assets folder, right-click on **app** and select **Folder** -> **Assets Folder** from the dropdown.
26+
27+
:::image type="content" source="../../media/how-tos/android-studio-assets-folder.png" alt-text="Screenshot of the Assets folder option.":::
28+
29+
1. Right-click on **assets** and select **New** -> **File**. Name the file **env**.
30+
31+
:::image type="content" source="../../media/how-tos/android-studio-create-env-file.png" alt-text="Screenshot of name input field to create the env file.":::
32+
33+
1. Add the following names and values, and supply values as appropriate. Don't commit this file into source control because it contains secrets that shouldn't be made public.
2334

2435
```text
2536
TENANT_ID=<YOUR_TENANT_ID>
@@ -34,5 +45,5 @@ Choose a device emulator from the AVD Manager, and run the project.
3445
3546
## Next steps
3647
37-
* Explore the [Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk) and the [Immersive Reader SDK reference](../../reference.md).
38-
* View code samples on [GitHub](https://github.com/microsoft/immersive-reader-sdk/tree/master/js/samples/).
48+
> [!div class="nextstepaction"]
49+
> [Explore the Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk)
Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
---
2-
author: rwallerms
2+
author: sharmas
33
manager: nitinme
44
ms.service: azure-ai-immersive-reader
55
ms.topic: include
6-
ms.date: 03/04/2021
7-
ms.author: rwaller
6+
ms.date: 02/21/2024
7+
ms.author: sharmas
88
---
99

1010
## Prerequisites
1111

12-
* Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services)
13-
* An Immersive Reader resource configured for Microsoft Entra authentication. Follow [these instructions](../../how-to-create-immersive-reader.md) to get set up. You will need some of the values created here when configuring the environment properties. Save the output of your session into a text file for future reference.
14-
* [macOS](https://www.apple.com/macos).
15-
* [Git](https://git-scm.com/).
16-
* [Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk).
17-
* [Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12).
12+
* An Azure subscription. You can [create one for free](https://azure.microsoft.com/free/ai-services).
13+
* An Immersive Reader resource configured for Microsoft Entra authentication. Follow [these instructions](../../how-to-create-immersive-reader.md) to get set up. Save the output of your session into a text file so you can configure the environment properties.
14+
* [macOS](https://www.apple.com/macos) and [Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12).
15+
* [Git](https://git-scm.com).
16+
* Clone the [Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk) from GitHub.
1817

1918
## Configure authentication credentials
2019

21-
1. Open Xcode, and open **immersive-reader-sdk/js/samples/ios/quickstart-swift/quickstart-swift.xcodeproj**.
20+
1. In Xcode, select **Open Existing Project**. Open the file *immersive-reader-sdk/js/samples/ios/quickstart-swift.xcodeproj*.
2221
1. On the top menu, select **Product** > **Scheme** > **Edit Scheme**.
2322
1. In the **Run** view, select the **Arguments** tab.
2423
1. In the **Environment Variables** section, add the following names and values. Supply the values given when you created your Immersive Reader resource.
@@ -34,9 +33,9 @@ Don't commit this change into source control because it contains secrets that sh
3433
3534
## Start the Immersive Reader with sample content
3635
37-
In Xcode, select **Ctrl+R** to run the project.
36+
In Xcode, select a device simulator, then run the project from the controls or enter **Ctrl+R**.
3837
39-
## Next steps
38+
## Next step
4039
41-
* Explore the [Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk) and the [Immersive Reader SDK reference](../../reference.md).
42-
* View code samples on [GitHub](https://github.com/microsoft/immersive-reader-sdk/tree/master/js/samples/).
40+
> [!div class="nextstepaction"]
41+
> [Explore the Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk)

articles/ai-services/immersive-reader/includes/how-to/how-to-launch-immersive-reader-nodejs.md

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
author: rwallerms
2+
author: sharmas
33
manager: nitinme
44
ms.service: azure-ai-immersive-reader
55
ms.topic: include
6-
ms.date: 03/04/2021
7-
ms.author: rwaller
6+
ms.date: 02/21/2024
7+
ms.author: sharmas
88
---
99

1010
## Prerequisites
1111

12-
* Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services)
13-
* An Immersive Reader resource configured for Microsoft Entra authentication. Follow [these instructions](../../how-to-create-immersive-reader.md) to get set up. You will need some of the values created here when configuring the environment properties. Save the output of your session into a text file for future reference.
14-
* [Node.js](https://nodejs.org/) and [Yarn](https://yarnpkg.com)
15-
* An IDE such as [Visual Studio Code](https://code.visualstudio.com/)
12+
* An Azure subscription. You can [create one for free](https://azure.microsoft.com/free/ai-services).
13+
* An Immersive Reader resource configured for Microsoft Entra authentication. Follow [these instructions](../../how-to-create-immersive-reader.md) to get set up. Save the output of your session into a text file so you can configure the environment properties.
14+
* [Node.js](https://nodejs.org) and [Yarn](https://yarnpkg.com).
15+
* An IDE such as [Visual Studio Code](https://code.visualstudio.com).
1616

1717
## Create a Node.js web app with Express
1818

@@ -24,30 +24,36 @@ express --view=pug myapp
2424
cd myapp
2525
```
2626

27-
Install yarn dependencies, and add dependencies `request` and `dotenv`, which will be used later in the tutorial.
27+
Install yarn dependencies, and add dependencies `request` and `dotenv`, which are used later in the tutorial.
2828

2929
```bash
3030
yarn
3131
yarn add request
3232
yarn add dotenv
3333
```
3434

35+
Install the axios and qs libraries with the following command:
36+
37+
```bash
38+
npm install axios qs
39+
```
40+
3541
<a name='acquire-an-azure-ad-authentication-token'></a>
3642

37-
## Acquire a Microsoft Entra authentication token
43+
## Set up authentication
3844

3945
Next, write a backend API to retrieve a Microsoft Entra authentication token.
4046

41-
You need some values from the Microsoft Entra auth configuration prerequisite step above for this part. Refer back to the text file you saved of that session.
47+
You need some values from the Microsoft Entra auth configuration prerequisite step for this part. Refer back to the text file you saved from that session.
4248

4349
````text
4450
TenantId => Azure subscription TenantId
45-
ClientId => Azure AD ApplicationId
46-
ClientSecret => Azure AD Application Service Principal password
51+
ClientId => Microsoft Entra ApplicationId
52+
ClientSecret => Microsoft Entra Application Service Principal password
4753
Subdomain => Immersive Reader resource subdomain (resource 'Name' if the resource was created in the Azure portal, or 'CustomSubDomain' option if the resource was created with Azure CLI PowerShell. Check the Azure portal for the subdomain on the Endpoint in the resource Overview page, for example, 'https://[SUBDOMAIN].cognitiveservices.azure.com/')
4854
````
4955

50-
Once you have these values, create a new file called _.env_, and paste the following code into it, supplying your custom property values from above. Do not include quotation marks or the "{" and "}" characters.
56+
Create a new file called *.env* in the root of your project. Paste the following code into it, supplying the values given when you created your Immersive Reader resource. Don't include quotation marks or the `{` and `}` characters.
5157

5258
```text
5359
TENANT_ID={YOUR_TENANT_ID}
@@ -56,15 +62,15 @@ CLIENT_SECRET={YOUR_CLIENT_SECRET}
5662
SUBDOMAIN={YOUR_SUBDOMAIN}
5763
```
5864

59-
Be sure not to commit this file into source control, as it contains secrets that should not be made public.
65+
Be sure not to commit this file into source control, as it contains secrets that shouldn't be made public.
6066

61-
Next, open _app.js_ and add the following to the top of the file. This loads the properties defined in the .env file as environment variables into Node.
67+
Next, open *app.js* and add the following to the top of the file. This loads the properties defined in the *.env* file as environment variables into Node.
6268

6369
```javascript
6470
require('dotenv').config();
6571
```
6672

67-
Open the _routes\index.js_ file and replace its content with the following code.
73+
Open the *routes\index.js* file and replace its content with the following code.
6874

6975
This code creates an API endpoint that acquires a Microsoft Entra authentication token using your service principal password. It also retrieves the subdomain. It then returns an object containing the token and subdomain.
7076

@@ -111,14 +117,14 @@ The **getimmersivereaderlaunchparams** API endpoint should be secured behind som
111117

112118
## Launch the Immersive Reader with sample content
113119

114-
1. Open _views\layout.pug_, and add the following code under the `head` tag, before the `body` tag. These `script` tags load the [Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk) and jQuery.
120+
1. Open *views\layout.pug*, and add the following code under the `head` tag, before the `body` tag. These `script` tags load the [Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk) and jQuery.
115121

116122
```pug
117123
script(src='https://ircdname.azureedge.net/immersivereadersdk/immersive-reader-sdk.1.2.0.js')
118124
script(src='https://code.jquery.com/jquery-3.3.1.min.js')
119125
```
120126
121-
2. Open _views\index.pug_, and replace its content with the following code. This code populates the page with some sample content, and adds a button that launches the Immersive Reader.
127+
2. Open *views\index.pug*, and replace its content with the following code. This code populates the page with some sample content, and adds a button that launches the Immersive Reader.
122128
123129
```pug
124130
extends layout
@@ -168,19 +174,19 @@ The **getimmersivereaderlaunchparams** API endpoint should be secured behind som
168174
npm start
169175
```
170176
171-
4. Open your browser and navigate to _http://localhost:3000_. You should see the above content on the page. Select the **Immersive Reader** button to launch the Immersive Reader with your content.
177+
4. Open your browser and navigate to `http://localhost:3000`. You should see the above content on the page. Select the **Immersive Reader** button to launch the Immersive Reader with your content.
172178
173179
## Specify the language of your content
174180
175-
The Immersive Reader has support for many different languages. You can specify the language of your content by following the steps below.
181+
The Immersive Reader has support for many different languages. You can specify the language of your content by following these steps.
176182
177-
1. Open _views\index.pug_ and add the following code below the `p(id=content)` tag that you added in the previous step. This code adds some content Spanish content to your page.
183+
1. Open *views\index.pug* and add the following code below the `p(id=content)` tag that you added in the previous step. This code adds some content Spanish content to your page.
178184
179185
```pug
180186
p(id='content-spanish') El estudio de las formas terrestres de la Tierra se llama geografía física. Los accidentes geográficos pueden ser montañas y valles. También pueden ser glaciares, lagos o ríos.
181187
```
182188
183-
2. In the JavaScript code, add the following above the call to `ImmersiveReader.launchAsync`. This code passes the Spanish content into the Immersive Reader.
189+
2. In *views\index.pug*, add the following code above the call to `ImmersiveReader.launchAsync`. This code passes the Spanish content into the Immersive Reader.
184190
185191
```pug
186192
content.chunks.push({
@@ -189,13 +195,13 @@ The Immersive Reader has support for many different languages. You can specify t
189195
});
190196
```
191197
192-
3. Navigate to _http://localhost:3000_ again. You should see the Spanish text on the page, and when you select **Immersive Reader**, it will show up in the Immersive Reader as well.
198+
3. Navigate to `http://localhost:3000` again. You should see the Spanish text on the page, and when you select **Immersive Reader**, it shows up in the Immersive Reader as well.
193199
194200
## Specify the language of the Immersive Reader interface
195201
196202
By default, the language of the Immersive Reader interface matches the browser's language settings. You can also specify the language of the Immersive Reader interface with the following code.
197203
198-
1. In _views\index.pug_, replace the call to `ImmersiveReader.launchAsync(token, subdomain, content)` with the code below.
204+
1. In *views\index.pug*, replace the call to `ImmersiveReader.launchAsync(token, subdomain, content)` with the following code.
199205
200206
```javascript
201207
const options = {
@@ -204,13 +210,13 @@ By default, the language of the Immersive Reader interface matches the browser's
204210
ImmersiveReader.launchAsync(token, subdomain, content, options);
205211
```
206212
207-
2. Navigate to _http://localhost:3000_. When you launch the Immersive Reader, the interface will be shown in French.
213+
2. Navigate to `http://localhost:3000`. When you launch the Immersive Reader, the interface is shown in French.
208214
209215
## Launch the Immersive Reader with math content
210216
211217
You can include math content in the Immersive Reader by using [MathML](https://developer.mozilla.org/en-US/docs/Web/MathML).
212218
213-
1. Modify _views\index.pug_ to include the following code above the call to `ImmersiveReader.launchAsync`:
219+
1. Modify *views\index.pug* to include the following code above the call to `ImmersiveReader.launchAsync`:
214220
215221
```javascript
216222
const mathML = '<math xmlns="https://www.w3.org/1998/Math/MathML" display="block"> \
@@ -235,9 +241,9 @@ You can include math content in the Immersive Reader by using [MathML](https://d
235241
});
236242
```
237243
238-
2. Navigate to _http://localhost:3000_. When you launch the Immersive Reader and scroll to the bottom, you'll see the math formula.
244+
2. Navigate to `http://localhost:3000`. When you launch the Immersive Reader and scroll to the bottom, you'll see the math formula.
239245
240-
## Next steps
246+
## Next step
241247
242-
* Explore the [Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk) and the [Immersive Reader SDK Reference](../../reference.md)
243-
* View code samples on [GitHub](https://github.com/microsoft/immersive-reader-sdk/tree/master/js/samples/advanced-csharp)
248+
> [!div class="nextstepaction"]
249+
> [Explore the Immersive Reader SDK](https://github.com/microsoft/immersive-reader-sdk)

0 commit comments

Comments
 (0)