You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-services/immersive-reader/how-to-launch-immersive-reader.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,20 @@
1
1
---
2
2
title: "How to launch the Immersive Reader"
3
3
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.
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.
* 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.
*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.
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).
21
21
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.
23
34
24
35
```text
25
36
TENANT_ID=<YOUR_TENANT_ID>
@@ -34,5 +45,5 @@ Choose a device emulator from the AVD Manager, and run the project.
34
45
35
46
## Next steps
36
47
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)
* 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.
* 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.
18
17
19
18
## Configure authentication credentials
20
19
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*.
22
21
1. On the top menu, select **Product** > **Scheme** > **Edit Scheme**.
23
22
1. In the **Run** view, select the **Arguments** tab.
24
23
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
34
33
35
34
## Start the Immersive Reader with sample content
36
35
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**.
38
37
39
-
## Next steps
38
+
## Next step
40
39
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)
Copy file name to clipboardExpand all lines: articles/ai-services/immersive-reader/includes/how-to/how-to-launch-immersive-reader-nodejs.md
+36-30Lines changed: 36 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
---
2
-
author: rwallerms
2
+
author: sharmas
3
3
manager: nitinme
4
4
ms.service: azure-ai-immersive-reader
5
5
ms.topic: include
6
-
ms.date: 03/04/2021
7
-
ms.author: rwaller
6
+
ms.date: 02/21/2024
7
+
ms.author: sharmas
8
8
---
9
9
10
10
## Prerequisites
11
11
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).
16
16
17
17
## Create a Node.js web app with Express
18
18
@@ -24,30 +24,36 @@ express --view=pug myapp
24
24
cd myapp
25
25
```
26
26
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.
28
28
29
29
```bash
30
30
yarn
31
31
yarn add request
32
32
yarn add dotenv
33
33
```
34
34
35
+
Install the axios and qs libraries with the following command:
Next, write a backend API to retrieve a Microsoft Entra authentication token.
40
46
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.
42
48
43
49
````text
44
50
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
47
53
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/')
48
54
````
49
55
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.
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.
60
66
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.
62
68
63
69
```javascript
64
70
require('dotenv').config();
65
71
```
66
72
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.
68
74
69
75
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.
70
76
@@ -111,14 +117,14 @@ The **getimmersivereaderlaunchparams** API endpoint should be secured behind som
111
117
112
118
## Launch the Immersive Reader with sample content
113
119
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.
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.
122
128
123
129
```pug
124
130
extends layout
@@ -168,19 +174,19 @@ The **getimmersivereaderlaunchparams** API endpoint should be secured behind som
168
174
npm start
169
175
```
170
176
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.
172
178
173
179
## Specify the language of your content
174
180
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.
176
182
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.
178
184
179
185
```pug
180
186
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.
181
187
```
182
188
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.
184
190
185
191
```pug
186
192
content.chunks.push({
@@ -189,13 +195,13 @@ The Immersive Reader has support for many different languages. You can specify t
189
195
});
190
196
```
191
197
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.
193
199
194
200
## Specify the language of the Immersive Reader interface
195
201
196
202
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.
197
203
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.
199
205
200
206
```javascript
201
207
const options = {
@@ -204,13 +210,13 @@ By default, the language of the Immersive Reader interface matches the browser's
0 commit comments