shaka-player 3.2.19 → 3.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/.github/workflows/build-and-test.yaml +4 -4
  2. package/.github/workflows/demo-version-index.yaml +6 -0
  3. package/.github/workflows/selenium-lab-tests.yaml +55 -16
  4. package/.github/workflows/update-screenshots.yaml +142 -0
  5. package/CHANGELOG.md +22 -0
  6. package/demo/common/asset.js +15 -0
  7. package/demo/common/assets.js +4 -2
  8. package/demo/common/message_ids.js +1 -0
  9. package/demo/custom.js +19 -0
  10. package/demo/locales/en.json +1 -0
  11. package/demo/locales/source.json +4 -0
  12. package/demo/main.js +14 -0
  13. package/dist/demo.compiled.debug.js +150 -148
  14. package/dist/demo.compiled.debug.map +3 -3
  15. package/dist/demo.compiled.js +150 -148
  16. package/dist/demo.compiled.map +3 -3
  17. package/dist/deps.js +1 -1
  18. package/dist/locales.js +28 -28
  19. package/dist/receiver.compiled.debug.js +19 -19
  20. package/dist/receiver.compiled.debug.map +2 -2
  21. package/dist/receiver.compiled.js +19 -19
  22. package/dist/receiver.compiled.map +2 -2
  23. package/dist/shaka-player.compiled.d.ts +7 -0
  24. package/dist/shaka-player.compiled.debug.d.ts +7 -0
  25. package/dist/shaka-player.compiled.debug.js +31 -31
  26. package/dist/shaka-player.compiled.debug.map +2 -2
  27. package/dist/shaka-player.compiled.js +84 -83
  28. package/dist/shaka-player.compiled.map +3 -3
  29. package/dist/shaka-player.ui.d.ts +7 -0
  30. package/dist/shaka-player.ui.debug.d.ts +7 -0
  31. package/dist/shaka-player.ui.debug.js +33 -33
  32. package/dist/shaka-player.ui.debug.map +2 -2
  33. package/dist/shaka-player.ui.js +56 -55
  34. package/dist/shaka-player.ui.map +3 -3
  35. package/docs/tutorials/errors.md +94 -0
  36. package/docs/tutorials/index.json +2 -0
  37. package/docs/tutorials/widevine-service-certs.md +45 -0
  38. package/externs/ima.js +9 -0
  39. package/lib/ads/client_side_ad_manager.js +6 -3
  40. package/lib/hls/hls_parser.js +2 -0
  41. package/lib/media/transmuxer.js +13 -7
  42. package/lib/media/video_wrapper.js +3 -3
  43. package/lib/offline/indexeddb/storage_mechanism.js +1 -1
  44. package/lib/player.js +3 -1
  45. package/lib/polyfill/media_capabilities.js +2 -8
  46. package/lib/polyfill/mediasource.js +7 -2
  47. package/lib/text/ui_text_displayer.js +1 -0
  48. package/lib/text/vtt_text_parser.js +4 -5
  49. package/lib/util/mime_utils.js +1 -1
  50. package/lib/util/stream_utils.js +26 -14
  51. package/package.json +1 -1
  52. package/test/polyfill/media_capabilities_unit.js +20 -22
  53. package/test/text/vtt_text_parser_unit.js +26 -2
  54. package/test/text/web_vtt_layout_integration.js +0 -3
@@ -16,7 +16,7 @@ on:
16
16
  # old one. If a PR is updated and a new test run is started, the old test run
17
17
  # will be cancelled automatically to conserve resources.
18
18
  concurrency:
19
- group: ${{ github.workflow }}-${{ github.event.inputs.ref || github.ref }}
19
+ group: ${{ github.workflow }}-${{ inputs.ref || github.ref }}
20
20
  cancel-in-progress: true
21
21
 
22
22
  jobs:
@@ -27,7 +27,7 @@ jobs:
27
27
  - name: Checkout code
28
28
  uses: actions/checkout@v3
29
29
  with:
30
- ref: ${{ github.event.inputs.ref || github.ref }}
30
+ ref: ${{ inputs.ref || github.ref }}
31
31
 
32
32
  - name: Lint
33
33
  run: python build/check.py
@@ -103,7 +103,7 @@ jobs:
103
103
  - name: Checkout code
104
104
  uses: actions/checkout@v3
105
105
  with:
106
- ref: ${{ github.event.inputs.ref || github.ref }}
106
+ ref: ${{ inputs.ref || github.ref }}
107
107
 
108
108
  # Older versions of Safari can be installed, but not to the root, and it
109
109
  # can't replace the standard version, at least not on GitHub's VMs. If
@@ -206,7 +206,7 @@ jobs:
206
206
  - name: Checkout code
207
207
  uses: actions/checkout@v3
208
208
  with:
209
- ref: ${{ github.event.inputs.ref || github.ref }}
209
+ ref: ${{ inputs.ref || github.ref }}
210
210
 
211
211
  - name: Docker
212
212
  run: |
@@ -11,6 +11,12 @@ on:
11
11
  - app-engine/demo-version-index/**
12
12
  release:
13
13
  types: [published]
14
+ # NOTE: So long as releases are made without a personal access token (PAT),
15
+ # they will not activate this workflow's release trigger. For now, the
16
+ # schedule trigger will compensate for that by updating the index nightly.
17
+ schedule:
18
+ # Run every night at 10pm PST / 6am UTC.
19
+ - cron: '0 6 * * *'
14
20
 
15
21
  jobs:
16
22
  appspot:
@@ -9,8 +9,24 @@ on:
9
9
  description: "A PR number to build and test in the lab. If empty, will build and test from main."
10
10
  required: false
11
11
  test_filter:
12
- description: "A filter to run a subset of the tests. If empty, all tests will run."
12
+ description: "A regex filter to run a subset of the tests. If empty, all tests will run."
13
13
  required: false
14
+ workflow_call:
15
+ # Allows for reuse from other workflows, such as "Update All Screenshots"
16
+ # workflow.
17
+ inputs:
18
+ pr:
19
+ description: "A PR number to build and test in the lab. If empty, will build and test from main."
20
+ required: false
21
+ type: string
22
+ test_filter:
23
+ description: "A regex filter to run a subset of the tests. If empty, all tests will run."
24
+ required: false
25
+ type: string
26
+ ignore_test_status:
27
+ description: "If true, ignore test success or failure, never set the commit status, and always upload screenshots."
28
+ required: false
29
+ type: boolean
14
30
  schedule:
15
31
  # Runs every night at 2am PST / 10am UTC, testing against the main branch.
16
32
  - cron: '0 10 * * *'
@@ -30,12 +46,12 @@ jobs:
30
46
  - name: Compute ref
31
47
  id: compute
32
48
  run: |
33
- if [[ "${{ github.event.inputs.pr }}" != "" ]]; then
34
- LAB_TEST_REF="refs/pull/${{ github.event.inputs.pr }}/head"
49
+ if [[ "${{ inputs.pr }}" != "" ]]; then
50
+ LAB_TEST_REF="refs/pull/${{ inputs.pr }}/head"
35
51
  else
36
52
  LAB_TEST_REF="main"
37
53
  fi
38
- echo "REF=$LAB_TEST_REF" >> $GITHUB_OUTPUT
54
+ echo "REF=$LAB_TEST_REF" | tee -a $GITHUB_OUTPUT
39
55
 
40
56
  # Configure the build matrix based on our grid's YAML config.
41
57
  # The matrix contents will be computed by this first job and deserialized
@@ -100,6 +116,7 @@ jobs:
100
116
  ref: ${{ needs.compute-ref.outputs.REF }}
101
117
 
102
118
  - name: Set commit status to pending
119
+ if: ${{ inputs.ignore_test_status == false }}
103
120
  uses: ./.github/workflows/custom-actions/set-commit-status
104
121
  with:
105
122
  context: Selenium / Build
@@ -117,8 +134,9 @@ jobs:
117
134
  retention-days: 1
118
135
 
119
136
  - name: Report final commit status
120
- # Will run on success or failure, but not if the workflow is cancelled.
121
- if: ${{ success() || failure() }}
137
+ # Will run on success or failure, but not if the workflow is cancelled
138
+ # or if we were asked to ignore the test status.
139
+ if: ${{ (success() || failure()) && inputs.ignore_test_status == false }}
122
140
  uses: ./.github/workflows/custom-actions/set-commit-status
123
141
  with:
124
142
  context: Selenium / Build
@@ -142,6 +160,7 @@ jobs:
142
160
  ref: ${{ needs.compute-ref.outputs.REF }}
143
161
 
144
162
  - name: Set commit status to pending
163
+ if: ${{ inputs.ignore_test_status == false }}
145
164
  uses: ./.github/workflows/custom-actions/set-commit-status
146
165
  with:
147
166
  context: Selenium / ${{ matrix.browser }}
@@ -185,20 +204,28 @@ jobs:
185
204
  # the container.
186
205
  - name: Test Player
187
206
  run: |
207
+ # Use of an array keeps elements intact, and allows an element to
208
+ # contain spaces without being expanded into multiple arguments in a
209
+ # shell command.
210
+ extra_flags=()
211
+
188
212
  # Generate a coverage report from uncompiled code on ChromeLinux.
189
213
  # It should be the uncompiled build, or else we won't execute any
190
214
  # coverage instrumentation on full-stack player integration tests.
191
215
  if [[ "${{ matrix.browser }}" == "ChromeLinux" ]]; then
192
- extra_flags="--html-coverage-report --uncompiled"
193
- else
194
- extra_flags=""
216
+ extra_flags+=(--html-coverage-report --uncompiled)
195
217
  fi
196
218
 
197
- filter="${{ github.event.inputs.test_filter }}"
198
- if [[ "$filter" != "" ]]; then
199
- extra_flags="$extra_flags --filter $filter"
219
+ if [[ "${{ inputs.test_filter }}" != "" ]]; then
220
+ echo "Adding filter: ${{ inputs.test_filter }}"
221
+ extra_flags+=(--filter "${{ inputs.test_filter }}")
200
222
  fi
201
223
 
224
+ # Do not automatically fail when a command fails. This allows us to
225
+ # implement the ignore_test_status input by capturing the exit code
226
+ # and examining it.
227
+ set +e
228
+ # Run the tests with any extra flags.
202
229
  python3 build/test.py \
203
230
  --no-build \
204
231
  --reporters spec --spec-hide-passed \
@@ -208,7 +235,18 @@ jobs:
208
235
  --grid-config build/shaka-lab.yaml \
209
236
  --grid-address selenium-grid.lab:4444 \
210
237
  --browsers ${{ matrix.browser }} \
211
- $extra_flags
238
+ "${extra_flags[@]}"
239
+ # Capture the test exit code immediately after running the tests.
240
+ # There cannot be any other command between test.py and here.
241
+ exit_code=$?
242
+
243
+ # If ignoring test status, treat this as an exit code of 0 (success).
244
+ if [[ "${{ inputs.ignore_test_status }}" == "true" ]]; then
245
+ exit_code=0
246
+ fi
247
+
248
+ # Report the captured (and possibly overridden) exit status.
249
+ exit $exit_code
212
250
 
213
251
  - name: Find coverage report (ChromeLinux only)
214
252
  id: coverage
@@ -252,7 +290,7 @@ jobs:
252
290
  # Upload new screenshots and diffs on failure; ignore if missing
253
291
  - name: Upload screenshots
254
292
  uses: actions/upload-artifact@v3
255
- if: ${{ failure() }}
293
+ if: ${{ failure() || inputs.ignore_test_status }}
256
294
  with:
257
295
  # In this workflow, "browser" is the selenium node name, which can
258
296
  # contain both browser and OS, such as "ChromeLinux".
@@ -264,8 +302,9 @@ jobs:
264
302
  retention-days: 5
265
303
 
266
304
  - name: Report final commit status
267
- # Will run on success or failure, but not if the workflow is cancelled.
268
- if: ${{ success() || failure() }}
305
+ # Will run on success or failure, but not if the workflow is cancelled
306
+ # or if we were asked to ignore the test status.
307
+ if: ${{ (success() || failure()) && inputs.ignore_test_status == false }}
269
308
  uses: ./.github/workflows/custom-actions/set-commit-status
270
309
  with:
271
310
  context: Selenium / ${{ matrix.browser }}
@@ -0,0 +1,142 @@
1
+ name: Update All Screenshots
2
+ # Updates all screenshots on an existing PR, assuming permission has been given
3
+ # to maintainers to make edits.
4
+
5
+ on:
6
+ workflow_dispatch:
7
+ # Allows for manual triggering on PRs. They should be reviewed first, to
8
+ # avoid malicious code executing in the lab.
9
+ inputs:
10
+ pr:
11
+ description: "A PR number to build and test in the lab, then update all the screenshots."
12
+ required: true
13
+
14
+ jobs:
15
+ set-pending-status:
16
+ name: Set Pending Status
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ with:
21
+ ref: refs/pull/${{ inputs.pr }}/head
22
+
23
+ - name: Set commit status to pending
24
+ uses: ./.github/workflows/custom-actions/set-commit-status
25
+ with:
26
+ context: Update All Screenshots
27
+ state: pending
28
+ token: ${{ secrets.GITHUB_TOKEN }}
29
+
30
+ run-lab-tests:
31
+ name: Get Selenium Lab Screenshots
32
+ needs: [set-pending-status]
33
+ uses: ./.github/workflows/selenium-lab-tests.yaml
34
+ with:
35
+ pr: ${{ inputs.pr }}
36
+ test_filter: layout
37
+ ignore_test_status: true
38
+
39
+ update-pr:
40
+ name: Update PR
41
+ runs-on: ubuntu-latest
42
+ needs: [run-lab-tests]
43
+ steps:
44
+ - uses: actions/checkout@v3
45
+ with:
46
+ ref: refs/pull/${{ inputs.pr }}/head
47
+
48
+ - name: Set commit status to pending
49
+ uses: ./.github/workflows/custom-actions/set-commit-status
50
+ with:
51
+ context: Update All Screenshots
52
+ state: pending
53
+ token: ${{ secrets.GITHUB_TOKEN }}
54
+
55
+ - name: Get artifacts
56
+ uses: actions/download-artifact@v3
57
+ with:
58
+ path: new-screenshots
59
+
60
+ - name: Move screenshots
61
+ run: |
62
+ # The download-artifact action puts zip file contents into folders by
63
+ # the name of the artifact, so we can't have them downloaded directly
64
+ # to the screenshots folder. Here we move them into the correct
65
+ # locations.
66
+ cd new-screenshots
67
+
68
+ # "$i" is a folder for an artifact (eg "screenshots-ChromeAndroid"),
69
+ # and it contains a single folder with the name we use in our
70
+ # screenshots (eg "chrome-Android"). We want the contents of that
71
+ # inner folder to be copied to test/test/assets/screenshots/, where a
72
+ # folder with the same name (eg "chrome-Android") already exists.
73
+ for i in screenshots*; do
74
+ cp -a $i/* ../test/test/assets/screenshots/
75
+ done
76
+
77
+ - name: Update screenshots
78
+ run: |
79
+ # Install prerequisites.
80
+ npm ci
81
+
82
+ # Update the official screenshots for any that have visibly changed.
83
+ # This is not a byte-for-byte comparison, but based on pixel diffs.
84
+ ./build/updateScreenshots.py
85
+
86
+ # Emulate the actions bot.
87
+ git config user.name "github-actions[bot]"
88
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
89
+
90
+ # Commit the changes. Ignore failure, in case there are no changes.
91
+ git add test/test/assets/screenshots/*/*.png || true
92
+ git commit -m ':robot: Update all screenshots' || true
93
+
94
+ - name: Update PR
95
+ env:
96
+ GH_TOKEN: ${{ github.token }}
97
+ run: |
98
+ # Update the PR.
99
+ PR_API_URL="/repos/${{ github.repository }}/pulls/${{ inputs.pr }}"
100
+ REMOTE=$(gh api $PR_API_URL | jq -r .head.repo.html_url)
101
+ BRANCH=$(gh api $PR_API_URL | jq -r .head.ref)
102
+
103
+ # If there were no changes, this will do nothing, but succeed.
104
+ git push "$REMOTE" HEAD:"$BRANCH"
105
+
106
+ - name: Debug
107
+ uses: mxschmitt/action-tmate@v3.6
108
+ with:
109
+ limit-access-to-actor: true
110
+ if: failure()
111
+
112
+ set-final-status:
113
+ name: Set Final Status
114
+ runs-on: ubuntu-latest
115
+ needs: [run-lab-tests, update-pr]
116
+ # Will run on success or failure, but not if the workflow is cancelled.
117
+ if: ${{ success() || failure() }}
118
+ steps:
119
+ - uses: actions/checkout@v3
120
+ with:
121
+ ref: refs/pull/${{ inputs.pr }}/head
122
+
123
+ - name: Compute final status
124
+ id: compute
125
+ run: |
126
+ LAB_TEST_STATUS="${{ needs.run-lab-tests.status }}"
127
+ UPDATE_PR_STATUS="${{ needs.update-pr.status }}"
128
+
129
+ # If run-lab-tests succeeded, use the status of update-pr, otherwise
130
+ # use run-lab-tests (which is "failed" or "error").
131
+ if [ "$LAB_TEST_STATUS" == "success" ]; then
132
+ echo "status=$UPDATE_PR_STATUS" >> $GITHUB_OUTPUT
133
+ else
134
+ echo "status=$LAST_TEST_STATUS" >> $GITHUB_OUTPUT
135
+ fi
136
+
137
+ - name: Report final status
138
+ uses: ./.github/workflows/custom-actions/set-commit-status
139
+ with:
140
+ context: Update All Screenshots
141
+ state: ${{ steps.compute.outputs.status }}
142
+ token: ${{ secrets.GITHUB_TOKEN }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.2.20](https://github.com/shaka-project/shaka-player/compare/v3.2.19...v3.2.20) (2023-03-02)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **Ads:** Fix CS volume ad ([#5016](https://github.com/shaka-project/shaka-player/issues/5016)) ([7d644ca](https://github.com/shaka-project/shaka-player/commit/7d644ca030112a227142ac2f236e4e0a16fd97bb))
9
+ * **Ads:** Fix usage of EventManager on CS ([#5017](https://github.com/shaka-project/shaka-player/issues/5017)) ([0fcaeaa](https://github.com/shaka-project/shaka-player/commit/0fcaeaac5aaa1cec019aa4f156ecd1bfc5575536))
10
+ * **ads:** Fix VMAP ads stay muted on muted autoplay ([#4995](https://github.com/shaka-project/shaka-player/issues/4995)) ([4c5cf61](https://github.com/shaka-project/shaka-player/commit/4c5cf613c7150eb7def6f9bb92d5925e17406cb9))
11
+ * Allow the playback of TS without mux.js ([#5041](https://github.com/shaka-project/shaka-player/issues/5041)) ([2e3c720](https://github.com/shaka-project/shaka-player/commit/2e3c720daf10d7236478965f3c6d13163b13c302))
12
+ * Caption can not turn off at iOS Safari ([#4978](https://github.com/shaka-project/shaka-player/issues/4978)) ([b644860](https://github.com/shaka-project/shaka-player/commit/b644860fd83a722a734141d9834252cca84fa354))
13
+ * **Demo:** Allow manifest type for DAI custom assets ([#4977](https://github.com/shaka-project/shaka-player/issues/4977)) ([2a66112](https://github.com/shaka-project/shaka-player/commit/2a6611249934f3f9b4190815fae95369dc5736a1))
14
+ * Failed to set 'currentTime' property on 'HTMLMediaElement' on a Hisense TV ([#4962](https://github.com/shaka-project/shaka-player/issues/4962)) ([59d2e09](https://github.com/shaka-project/shaka-player/commit/59d2e09e98a66558e65c33b7d55ea8345f3f8099))
15
+ * Fallback to isTypeSupported when cast namespace is undefined ([#5012](https://github.com/shaka-project/shaka-player/issues/5012)) ([1834ad3](https://github.com/shaka-project/shaka-player/commit/1834ad3d865bfc900c82738a95f2f278735e0385))
16
+ * Fix video/mp2t mimetype conversion. ([#5039](https://github.com/shaka-project/shaka-player/issues/5039)) ([cec2b28](https://github.com/shaka-project/shaka-player/commit/cec2b287b52cebcc89e66d7c2f2b4b24dedfef1a))
17
+ * **HLS:** Add `.tsa` and .`tsv` file extensions as valid MPEG2-TS. ([#5034](https://github.com/shaka-project/shaka-player/issues/5034)) ([6c4efe2](https://github.com/shaka-project/shaka-player/commit/6c4efe2a4fedaf74fb0151504adada6f597dbf9a))
18
+ * Increase IndexedDB timeout ([#4984](https://github.com/shaka-project/shaka-player/issues/4984)) ([2b81cb4](https://github.com/shaka-project/shaka-player/commit/2b81cb44f9345a473fbf04dbf00612b45fad3c57))
19
+ * **MCap:** Remove robustness when robustness value is default ([#4953](https://github.com/shaka-project/shaka-player/issues/4953)) ([6115dd7](https://github.com/shaka-project/shaka-player/commit/6115dd7f095b35c98ded89cbcbe8dc0124777e6e))
20
+ * Prevent content from being restarted after Postroll ads ([#4979](https://github.com/shaka-project/shaka-player/issues/4979)) ([8969f1e](https://github.com/shaka-project/shaka-player/commit/8969f1e2cbb2ce73a3c1da693b7d2be4825e3247))
21
+ * Reject TS content on Edge ([#5043](https://github.com/shaka-project/shaka-player/issues/5043)) ([c5c4d0f](https://github.com/shaka-project/shaka-player/commit/c5c4d0f42a0af0a95e231c89ae24383efffae474))
22
+ * **VTT:** Fix spacing between text lines ([#4961](https://github.com/shaka-project/shaka-player/issues/4961)) ([40bff87](https://github.com/shaka-project/shaka-player/commit/40bff87ccb2212e7cd88a93d83c8902a41d116ea))
23
+ * **WebVTT:** Tags in the WebVTT subtitle are not parsed ([#4960](https://github.com/shaka-project/shaka-player/issues/4960)) ([542883f](https://github.com/shaka-project/shaka-player/commit/542883f2cd6783d0f063a0eff0e83118c0c89132))
24
+
3
25
  ## [3.2.19](https://github.com/shaka-project/shaka-player/compare/v3.2.18...v3.2.19) (2023-01-31)
4
26
 
5
27
 
@@ -76,6 +76,8 @@ const ShakaDemoAssetInfo = class {
76
76
  /** @type {?string} */
77
77
  this.imaContentSrcId = null;
78
78
  /** @type {?string} */
79
+ this.imaManifestType = null;
80
+ /** @type {?string} */
79
81
  this.mimeType = null;
80
82
 
81
83
 
@@ -256,6 +258,19 @@ const ShakaDemoAssetInfo = class {
256
258
  return this;
257
259
  }
258
260
 
261
+ /**
262
+ * @param {string} type
263
+ * @return {!ShakaDemoAssetInfo}
264
+ */
265
+ setIMAManifestType(type) {
266
+ this.imaManifestType = type;
267
+ if (!this.features.includes(shakaAssets.Feature.ADS)) {
268
+ this.addFeature(shakaAssets.Feature.ADS);
269
+ }
270
+
271
+ return this;
272
+ }
273
+
259
274
  /**
260
275
  * @param {string} headerName
261
276
  * @param {string} headerValue
@@ -491,7 +491,8 @@ shakaAssets.testAssets = [
491
491
  .addFeature(shakaAssets.Feature.MP4)
492
492
  .addFeature(shakaAssets.Feature.OFFLINE)
493
493
  .setIMAContentSourceId('2528370')
494
- .setIMAVideoId('tears-of-steel'),
494
+ .setIMAVideoId('tears-of-steel')
495
+ .setIMAManifestType('HLS'),
495
496
  new ShakaDemoAssetInfo(
496
497
  /* name= */ 'Tears of Steel (live, DASH, Server Side ads)',
497
498
  /* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/tears_of_steel.png',
@@ -501,7 +502,8 @@ shakaAssets.testAssets = [
501
502
  .addFeature(shakaAssets.Feature.MP4)
502
503
  .addFeature(shakaAssets.Feature.SUBTITLES)
503
504
  .addFeature(shakaAssets.Feature.LIVE)
504
- .setIMAAssetKey('PSzZMzAkSXCmlJOWDmRj8Q'),
505
+ .setIMAAssetKey('PSzZMzAkSXCmlJOWDmRj8Q')
506
+ .setIMAManifestType('DASH'),
505
507
  new ShakaDemoAssetInfo(
506
508
  /* name= */ 'Tears of Steel (multicodec, surround + stereo)',
507
509
  /* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/tears_of_steel.png',
@@ -96,6 +96,7 @@ shakaDemo.MessageIds = {
96
96
  ADS_TAB: 'DEMO_ADS_TAB',
97
97
  IMA_ASSET_KEY: 'DEMO_IMA_ASSET_KEY',
98
98
  IMA_CONTENT_SRC_ID: 'DEMO_IMA_CONTENT_SRC_ID',
99
+ IMA_MANIFEST_TYPE: 'DEMO_IMA_MANIFEST_TYPE',
99
100
  IMA_VIDEO_ID: 'DEMO_IMA_VIDEO_ID',
100
101
  CANCEL_BUTTON: 'DEMO_CANCEL_BUTTON',
101
102
  CUSTOM_INTRO_ONE: 'DEMO_CUSTOM_INTRO_ONE',
package/demo/custom.js CHANGED
@@ -328,6 +328,25 @@ shakaDemo.Custom = class {
328
328
  this.makeField_(
329
329
  container, assetKeyName, assetKeySetup, assetKeyChange);
330
330
 
331
+ // Make the manifest type field.
332
+ const manifestTypeSetup = (input, container) => {
333
+ if (assetInProgress.imaManifestType) {
334
+ input.value = assetInProgress.imaManifestType;
335
+ }
336
+
337
+ this.manifestField_.required =
338
+ this.checkManifestRequired_(assetInProgress);
339
+ };
340
+ const manifestTypeChange = (input) => {
341
+ assetInProgress.imaManifestType = input.value;
342
+ this.manifestField_.required =
343
+ this.checkManifestRequired_(assetInProgress);
344
+ };
345
+ const manifestTypeName = shakaDemoMain.getLocalizedString(
346
+ shakaDemo.MessageIds.IMA_MANIFEST_TYPE);
347
+ this.makeField_(
348
+ container, manifestTypeName, manifestTypeSetup, manifestTypeChange);
349
+
331
350
  return adsDiv;
332
351
  }
333
352
 
@@ -91,6 +91,7 @@
91
91
  "DEMO_IGNORE_HLS_TEXT_FAILURES": "Ignore HLS Text Stream Failures",
92
92
  "DEMO_IMA_ASSET_KEY": "Asset key (for LIVE DAI Content)",
93
93
  "DEMO_IMA_CONTENT_SRC_ID": "Content source ID (for VOD DAI Content)",
94
+ "DEMO_IMA_MANIFEST_TYPE": "Manifest type (for DAI Content)",
94
95
  "DEMO_IMA_VIDEO_ID": "Video ID (for VOD DAI Content)",
95
96
  "DEMO_IGNORE_MIN_BUFFER_TIME": "Ignore Min Buffer Time",
96
97
  "DEMO_IGNORE_TEXT_FAILURES": "Ignore Text Stream Failures",
@@ -367,6 +367,10 @@
367
367
  "description": "The label on a field that allows users to provide a content source id for a custom asset.",
368
368
  "message": "Asset key (for VOD DAI Content)"
369
369
  },
370
+ "DEMO_IMA_MANIFEST_TYPE": {
371
+ "description": "The label on a field that allows users to provide a manifest type for a custom asset.",
372
+ "message": "Manifest type (for DAI Content)"
373
+ },
370
374
  "DEMO_IMA_VIDEO_ID": {
371
375
  "description": "The label on a field that allows users to provide a video id for a custom asset.",
372
376
  "message": "Video ID (for VOD DAI Content)"
package/demo/main.js CHANGED
@@ -1502,6 +1502,20 @@ shakaDemo.Main = class {
1502
1502
  request.contentSourceId = asset.imaContentSrcId;
1503
1503
  request.videoId = asset.imaVideoId;
1504
1504
  }
1505
+ switch (asset.imaManifestType) {
1506
+ case 'DASH':
1507
+ case 'dash':
1508
+ case 'MPD':
1509
+ case 'mpd':
1510
+ request.format = google.ima.dai.api.StreamRequest.StreamFormat.DASH;
1511
+ break;
1512
+ case 'HLS':
1513
+ case 'hls':
1514
+ case 'M3U8':
1515
+ case 'm3u8':
1516
+ request.format = google.ima.dai.api.StreamRequest.StreamFormat.HLS;
1517
+ break;
1518
+ }
1505
1519
 
1506
1520
  const uri = await adManager.requestServerSideStream(
1507
1521
  request, /* backupUri= */ asset.manifestUri);