shaka-player 4.0.2 → 4.0.5
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.
- package/.github/workflows/build-and-test.yaml +67 -15
- package/.github/workflows/compute-incremental-coverage.py +251 -0
- package/.github/workflows/report-incremental-coverage.yaml +39 -0
- package/.github/workflows/selenium-lab-tests.yaml +44 -1
- package/AUTHORS +2 -0
- package/CHANGELOG.md +43 -0
- package/CONTRIBUTORS +4 -0
- package/README.md +20 -6
- package/demo/common/assets.js +1 -1
- package/demo/index.html +1 -3
- package/demo/main.js +3 -3
- package/dist/controls.css +1 -1
- package/dist/demo.compiled.debug.js +3 -3
- package/dist/demo.compiled.debug.map +2 -2
- package/dist/demo.compiled.js +3 -3
- package/dist/demo.compiled.map +2 -2
- package/dist/deps.js +3 -3
- package/dist/locales.js +29 -29
- package/dist/receiver.compiled.debug.js +1 -1
- package/dist/receiver.compiled.debug.map +1 -1
- package/dist/receiver.compiled.js +1 -1
- package/dist/receiver.compiled.map +1 -1
- package/dist/shaka-player.compiled.d.ts +12 -1
- package/dist/shaka-player.compiled.debug.d.ts +12 -1
- package/dist/shaka-player.compiled.debug.externs.js +52 -40
- package/dist/shaka-player.compiled.debug.js +269 -256
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +52 -40
- package/dist/shaka-player.compiled.js +739 -730
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +12 -1
- package/dist/shaka-player.ui.debug.d.ts +12 -1
- package/dist/shaka-player.ui.debug.externs.js +52 -40
- package/dist/shaka-player.ui.debug.js +296 -282
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +52 -40
- package/dist/shaka-player.ui.js +885 -878
- package/dist/shaka-player.ui.map +4 -4
- package/docs/tutorials/ui.md +5 -5
- package/docs/tutorials/upgrade.md +1 -0
- package/docs/tutorials/welcome.md +6 -3
- package/externs/shaka/player.js +4 -2
- package/karma.conf.js +3 -11
- package/lib/ads/client_side_ad_manager.js +1 -1
- package/lib/dash/dash_parser.js +5 -0
- package/lib/hls/hls_parser.js +183 -70
- package/lib/media/drm_engine.js +1 -1
- package/lib/media/media_source_engine.js +57 -24
- package/lib/media/presentation_timeline.js +24 -1
- package/lib/media/segment_index.js +26 -1
- package/lib/media/segment_reference.js +10 -3
- package/lib/media/streaming_engine.js +4 -4
- package/lib/media/time_ranges_utils.js +46 -0
- package/lib/player.js +1 -6
- package/lib/polyfill/media_capabilities.js +9 -0
- package/lib/polyfill/videoplaybackquality.js +3 -1
- package/lib/text/cue.js +0 -5
- package/lib/text/simple_text_displayer.js +21 -9
- package/lib/text/ui_text_displayer.js +83 -19
- package/lib/util/buffer_utils.js +3 -0
- package/lib/util/object_utils.js +1 -0
- package/lib/util/platform.js +19 -1
- package/lib/util/stream_utils.js +24 -3
- package/lib/util/string_utils.js +102 -13
- package/maintained-branches.md +15 -0
- package/package.json +3 -5
- package/test/hls/hls_parser_unit.js +102 -8
- package/test/media/drm_engine_integration.js +24 -8
- package/test/media/media_source_engine_integration.js +24 -10
- package/test/media/media_source_engine_unit.js +53 -38
- package/test/media/streaming_engine_unit.js +28 -27
- package/test/test/util/fake_media_source_engine.js +10 -9
- package/test/text/simple_text_displayer_unit.js +27 -0
- package/test/text/ui_text_displayer_unit.js +65 -0
- package/test/util/string_utils_unit.js +46 -8
- package/ui/text_selection.js +2 -2
- package/app-engine/README.md +0 -9
- package/app-engine/demo-version-index/README.md +0 -14
- package/app-engine/demo-version-index/app.yaml +0 -28
- package/app-engine/demo-version-index/generate.py +0 -164
- package/app-engine/demo-version-index/main.py +0 -11
- package/app-engine/demo-version-index/requirements.txt +0 -5
- package/app-engine/demo-version-index/templates/index.html +0 -114
- package/app-engine/shaka-player-demo/README.md +0 -18
- package/app-engine/shaka-player-demo/app.yaml +0 -61
- package/app-engine/shaka-player-demo/main.py +0 -95
- package/app-engine/shaka-player-demo/posters/10yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/10yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/1yo.jpg +0 -0
- package/app-engine/shaka-player-demo/posters/2yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/2yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/3yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/3yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/4yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/4yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/5yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/5yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/6yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/6yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/7yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/7yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/8yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/8yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/9yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/9yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/audioOnly.gif +0 -0
- package/app-engine/shaka-player-demo/posters/audioRickRoll.gif +0 -0
- package/app-engine/shaka-player-demo/posters/colorbars.gif +0 -0
- package/app-engine/shaka-player-demo/posters/fireworks.jpg +0 -0
- package/app-engine/shaka-player-demo/posters/party-hat.png +0 -0
- package/app-engine/shaka-player-demo/posters/sources.txt +0 -46
- package/app-engine/shaka-player-demo/posters/standard.png +0 -0
- package/app-engine/shaka-player-demo/posters/trek.jpg +0 -0
- package/app-engine/shaka-player-demo/posters/valentines.png +0 -0
- package/app-engine/shaka-player-demo/posters/zombie.jpg +0 -0
- package/app-engine/shaka-player-demo/posters.py +0 -110
- package/app-engine/shaka-player-demo/requirements.txt +0 -5
- package/app-engine/shaka-player-demo/time.txt +0 -1
- package/build/README.md +0 -127
- package/build/__init__.py +0 -0
- package/build/all.py +0 -150
- package/build/apps.py +0 -186
- package/build/build.py +0 -392
- package/build/check.py +0 -354
- package/build/checkversion.py +0 -84
- package/build/compiler.py +0 -513
- package/build/conformance.textproto +0 -335
- package/build/docker/Dockerfile +0 -20
- package/build/docker/docker-compose.yml +0 -10
- package/build/docs.py +0 -54
- package/build/eslint-plugin-shaka-rules/arg-comment-spacing.js +0 -72
- package/build/eslint-plugin-shaka-rules/index.js +0 -24
- package/build/eslint-plugin-shaka-rules/package.json +0 -7
- package/build/eslint-plugin-shaka-rules/private.js +0 -109
- package/build/gendeps.py +0 -71
- package/build/generateExterns.js +0 -867
- package/build/generateLocalizations.py +0 -262
- package/build/generateTsDefs.py +0 -137
- package/build/install-linux-prereqs.sh +0 -136
- package/build/license-header +0 -5
- package/build/misspellings.txt +0 -39
- package/build/pixelsChanged.js +0 -35
- package/build/shaka-lab.yaml +0 -161
- package/build/shakaBuildHelpers.py +0 -356
- package/build/stats.py +0 -816
- package/build/subprocessWindowsPatch.py +0 -103
- package/build/test.py +0 -541
- package/build/types/ads +0 -8
- package/build/types/cast +0 -6
- package/build/types/cea +0 -13
- package/build/types/complete +0 -9
- package/build/types/core +0 -108
- package/build/types/dash +0 -8
- package/build/types/hls +0 -9
- package/build/types/manifests +0 -5
- package/build/types/networking +0 -6
- package/build/types/offline +0 -22
- package/build/types/polyfill +0 -18
- package/build/types/text +0 -11
- package/build/types/ui +0 -39
- package/build/updateScreenshots.py +0 -85
- package/build/wrapper.template.js +0 -52
|
@@ -5,6 +5,29 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
describe('StringUtils', () => {
|
|
8
|
+
describe('with TextDecoder', () => {
|
|
9
|
+
if (window.TextDecoder) {
|
|
10
|
+
defineStringUtilTests();
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe('without TextDecoder', () => {
|
|
15
|
+
let originalTextDecoder;
|
|
16
|
+
|
|
17
|
+
beforeAll(() => {
|
|
18
|
+
originalTextDecoder = window.TextDecoder;
|
|
19
|
+
window['TextDecoder'] = null;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
afterAll(() => {
|
|
23
|
+
window.TextDecoder = originalTextDecoder;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
defineStringUtilTests();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
function defineStringUtilTests() {
|
|
8
31
|
const StringUtils = shaka.util.StringUtils;
|
|
9
32
|
|
|
10
33
|
it('parses fromUTF8', () => {
|
|
@@ -16,19 +39,34 @@ describe('StringUtils', () => {
|
|
|
16
39
|
});
|
|
17
40
|
|
|
18
41
|
it('won\'t break if given cut-off UTF8 character', () => {
|
|
19
|
-
|
|
20
|
-
// at the very end of the string.
|
|
21
|
-
const arr1 = [0x53, 0x61, 0x6e, 0x20, 0x4a, 0x6f, 0x73, 0x81];
|
|
42
|
+
const arr1 = [0x53, 0x61, 0x6e, 0x20, 0x4a, 0x6f, 0x73, 0xc3, 0xa9];
|
|
22
43
|
expect(StringUtils.fromUTF8(new Uint8Array(arr1)))
|
|
44
|
+
.toBe('San Jos\u00E9');
|
|
45
|
+
|
|
46
|
+
// This array contains the first half of a 2-byte UTF8 character
|
|
47
|
+
// (0xc3 0xa9 = é). The half-character is stranded at the very end of the
|
|
48
|
+
// string.
|
|
49
|
+
const arr = [0x53, 0x61, 0x6e, 0x20, 0x4a, 0x6f, 0x73, 0xc3];
|
|
50
|
+
expect(StringUtils.fromUTF8(new Uint8Array(arr)))
|
|
23
51
|
.toBe('San Jos\uFFFD');
|
|
52
|
+
});
|
|
24
53
|
|
|
25
|
-
|
|
26
|
-
//
|
|
27
|
-
const
|
|
28
|
-
expect(StringUtils.fromUTF8(new Uint8Array(
|
|
54
|
+
it('won\'t break if given an invalid UTF-8 sequence', () => {
|
|
55
|
+
// 0xe9 0x33 0x33 is an invalid UTF-8 sequence.
|
|
56
|
+
const arr = [0x4a, 0x6f, 0x73, 0xE9, 0x33, 0x33, 0x20, 0x53, 0x61, 0x6e];
|
|
57
|
+
expect(StringUtils.fromUTF8(new Uint8Array(arr)))
|
|
29
58
|
.toBe('Jos\uFFFD33 San');
|
|
30
59
|
});
|
|
31
60
|
|
|
61
|
+
it('can handle an 8-byte character', () => {
|
|
62
|
+
// This is the UTF-8 encoding of the US flag emoji.
|
|
63
|
+
// It decodes into two Unicode codepoints, which becomes 4 JavaScript
|
|
64
|
+
// UTF-16 characters.
|
|
65
|
+
const arr = [0xf0, 0x9f, 0x87, 0xba, 0xf0, 0x9f, 0x87, 0xb8];
|
|
66
|
+
expect(StringUtils.fromUTF8(new Uint8Array(arr)))
|
|
67
|
+
.toBe('\uD83C\uDDFA\uD83C\uDDF8');
|
|
68
|
+
});
|
|
69
|
+
|
|
32
70
|
it('strips the BOM in fromUTF8', () => {
|
|
33
71
|
// This is 4 Unicode characters, the last will be split into a surrogate
|
|
34
72
|
// pair.
|
|
@@ -125,4 +163,4 @@ describe('StringUtils', () => {
|
|
|
125
163
|
expect(StringUtils.fromUTF16(buffer, true).length)
|
|
126
164
|
.toBe(buffer.byteLength / 2);
|
|
127
165
|
});
|
|
128
|
-
}
|
|
166
|
+
}
|
package/ui/text_selection.js
CHANGED
|
@@ -111,11 +111,11 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
|
|
|
111
111
|
onCaptionStateChange_() {
|
|
112
112
|
if (this.player.isTextTrackVisible()) {
|
|
113
113
|
this.icon.textContent =
|
|
114
|
-
shaka.ui.Enums.MaterialDesignIcons.
|
|
114
|
+
shaka.ui.Enums.MaterialDesignIcons.CLOSED_CAPTIONS;
|
|
115
115
|
this.button.ariaPressed = 'true';
|
|
116
116
|
} else {
|
|
117
117
|
this.icon.textContent =
|
|
118
|
-
shaka.ui.Enums.MaterialDesignIcons.
|
|
118
|
+
shaka.ui.Enums.MaterialDesignIcons.CLOSED_CAPTIONS_OFF;
|
|
119
119
|
this.button.ariaPressed = 'false';
|
|
120
120
|
}
|
|
121
121
|
|
package/app-engine/README.md
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# Google App Engine Code
|
|
2
|
-
|
|
3
|
-
This folder contains source code for the services we run on Google App Engine
|
|
4
|
-
(appspot.com).
|
|
5
|
-
|
|
6
|
-
- shaka-player-demo: Our hosted demo on https://shaka-player-demo.appspot.com/
|
|
7
|
-
|
|
8
|
-
- demo-version-index: An index of Shaka Player releases and demos, hosted at
|
|
9
|
-
https://index-dot-shaka-player-demo.appspot.com/
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Google App Engine Version Index
|
|
2
|
-
|
|
3
|
-
This folder contains everything necessary to host an index of Shaka Player
|
|
4
|
-
releases and demos at https://index-dot-shaka-player-demo.appspot.com/
|
|
5
|
-
|
|
6
|
-
- app.yaml: App Engine config file. Defines the runtime (Python 3).
|
|
7
|
-
|
|
8
|
-
- generate.py: A python script that generates the index's static content from
|
|
9
|
-
a template.
|
|
10
|
-
|
|
11
|
-
- requirements.txt: Used by App Engine to install the necessary Python server
|
|
12
|
-
requirements (Flask).
|
|
13
|
-
|
|
14
|
-
- templates/index.html: A Jinja2 template used to generate the index HTML.
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# Copyright 2022 Google LLC
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
runtime: python39
|
|
16
|
-
default_expiration: 1h
|
|
17
|
-
|
|
18
|
-
handlers:
|
|
19
|
-
# Server static/index.html as the root.
|
|
20
|
-
- url: /
|
|
21
|
-
secure: always
|
|
22
|
-
static_files: static/index.html
|
|
23
|
-
upload: static/index.html
|
|
24
|
-
# Any other requests are served from the static/ folder.
|
|
25
|
-
- url: /(.+)
|
|
26
|
-
secure: always
|
|
27
|
-
static_files: static/\1
|
|
28
|
-
upload: static/.+
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
# Shaka Player Version Index Generator
|
|
4
|
-
# Copyright 2022 Google LLC
|
|
5
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
|
|
7
|
-
# Generate an index of Shaka Player versions on appspot.
|
|
8
|
-
|
|
9
|
-
import collections
|
|
10
|
-
import jinja2
|
|
11
|
-
import os
|
|
12
|
-
import re
|
|
13
|
-
import subprocess
|
|
14
|
-
|
|
15
|
-
DEMO_URL_TEMPLATE = 'https://{0}-dot-shaka-player-demo.appspot.com/'
|
|
16
|
-
|
|
17
|
-
# In Google Hosted Libraries
|
|
18
|
-
HOSTED_URL_TEMPLATE = 'https://ajax.googleapis.com/ajax/libs/shaka-player/{0}/shaka-player.{1}'
|
|
19
|
-
|
|
20
|
-
# Before Google Hosted Libraries, v1 appspot URLs
|
|
21
|
-
V1_URL_TEMPLATE = 'https://{0}-dot-shaka-player-demo.appspot.com/shaka-player.{1}'
|
|
22
|
-
# Before Google Hosted Libraries, v2 appspot URLs
|
|
23
|
-
V2_URL_TEMPLATE = 'https://{0}-dot-shaka-player-demo.appspot.com/dist/shaka-player.{1}'
|
|
24
|
-
|
|
25
|
-
def version_to_demo_url(v):
|
|
26
|
-
return DEMO_URL_TEMPLATE.format(v.replace('.', '-'))
|
|
27
|
-
|
|
28
|
-
def version_to_lib_url(v):
|
|
29
|
-
if v == 'nightly':
|
|
30
|
-
return V2_URL_TEMPLATE.format(v, 'compiled.js')
|
|
31
|
-
elif (version_key(v) == version_key('v1.6.5') or
|
|
32
|
-
version_key(v) >= version_key('v2.0.6')):
|
|
33
|
-
return HOSTED_URL_TEMPLATE.format(v.replace('v', ''), 'compiled.js')
|
|
34
|
-
elif version_key(v) >= version_key('v2.0.0-beta'):
|
|
35
|
-
return V2_URL_TEMPLATE.format(v.replace('.', '-'), 'compiled.js')
|
|
36
|
-
else:
|
|
37
|
-
return V1_URL_TEMPLATE.format(v.replace('.', '-'), 'compiled.js')
|
|
38
|
-
|
|
39
|
-
def version_to_ui_lib_url(v):
|
|
40
|
-
if v == 'nightly':
|
|
41
|
-
return V2_URL_TEMPLATE.format(v, 'ui.js')
|
|
42
|
-
elif version_key(v) >= version_key('v2.5.0'):
|
|
43
|
-
return HOSTED_URL_TEMPLATE.format(v.replace('v', ''), 'ui.js')
|
|
44
|
-
else:
|
|
45
|
-
return None
|
|
46
|
-
|
|
47
|
-
def version_to_lib_externs_url(v):
|
|
48
|
-
if v == 'nightly':
|
|
49
|
-
return V2_URL_TEMPLATE.format(v, 'compiled.externs.js')
|
|
50
|
-
elif version_key(v) >= version_key('v2.0.6'):
|
|
51
|
-
return HOSTED_URL_TEMPLATE.format(v.replace('v', ''), 'compiled.externs.js')
|
|
52
|
-
else:
|
|
53
|
-
return None
|
|
54
|
-
|
|
55
|
-
def version_to_ui_lib_externs_url(v):
|
|
56
|
-
if v == 'nightly':
|
|
57
|
-
return V2_URL_TEMPLATE.format(v, 'ui.externs.js')
|
|
58
|
-
elif version_key(v) >= version_key('v2.5.0'):
|
|
59
|
-
return HOSTED_URL_TEMPLATE.format(v.replace('v', ''), 'ui.externs.js')
|
|
60
|
-
else:
|
|
61
|
-
return None
|
|
62
|
-
|
|
63
|
-
def version_to_lib_defs_url(v):
|
|
64
|
-
if v == 'nightly':
|
|
65
|
-
return V2_URL_TEMPLATE.format(v, 'compiled.d.ts')
|
|
66
|
-
elif version_key(v) >= version_key('v3.0.6'):
|
|
67
|
-
return HOSTED_URL_TEMPLATE.format(v.replace('v', ''), 'compiled.d.ts')
|
|
68
|
-
else:
|
|
69
|
-
return None
|
|
70
|
-
|
|
71
|
-
def version_to_ui_lib_defs_url(v):
|
|
72
|
-
if v == 'nightly':
|
|
73
|
-
return V2_URL_TEMPLATE.format(v, 'ui.d.ts')
|
|
74
|
-
elif version_key(v) >= version_key('v3.0.6'):
|
|
75
|
-
return HOSTED_URL_TEMPLATE.format(v.replace('v', ''), 'ui.d.ts')
|
|
76
|
-
else:
|
|
77
|
-
return None
|
|
78
|
-
|
|
79
|
-
def version_to_metadata(v):
|
|
80
|
-
return {
|
|
81
|
-
'version': v,
|
|
82
|
-
'best': False, # Corrected later in another loop
|
|
83
|
-
'demo': version_to_demo_url(v),
|
|
84
|
-
'lib': version_to_lib_url(v),
|
|
85
|
-
'ui_lib': version_to_ui_lib_url(v),
|
|
86
|
-
'lib_externs': version_to_lib_externs_url(v),
|
|
87
|
-
'ui_lib_externs': version_to_ui_lib_externs_url(v),
|
|
88
|
-
'lib_defs': version_to_lib_defs_url(v),
|
|
89
|
-
'ui_lib_defs': version_to_ui_lib_defs_url(v),
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
def is_release_tag(name):
|
|
93
|
-
matches = re.match(r'v\d+\.\d+\.\d+(-.+)?', name)
|
|
94
|
-
# Doesn't match, not a version tag.
|
|
95
|
-
if not matches:
|
|
96
|
-
return False
|
|
97
|
-
# A "master" (old) or "main" (new) tag, indicating the state of the main
|
|
98
|
-
# branch at the time of a release. Not an actual version in itself, though.
|
|
99
|
-
if matches.group(1) == '-master' or matches.group(1) == '-main':
|
|
100
|
-
return False
|
|
101
|
-
# For historical reasons, these oldest few tags are not currently deployed to
|
|
102
|
-
# appengine. All other matching tags are, though.
|
|
103
|
-
if name in ['v1.2.0', 'v1.2.1', 'v1.2.2', 'v1.2.3']:
|
|
104
|
-
return False
|
|
105
|
-
return True
|
|
106
|
-
|
|
107
|
-
def version_key(version):
|
|
108
|
-
if version == 'nightly':
|
|
109
|
-
# A false version number for nightly, greater than any actual release
|
|
110
|
-
# version.
|
|
111
|
-
return [float('inf')]
|
|
112
|
-
|
|
113
|
-
assert version[0] == 'v'
|
|
114
|
-
main_version, _, suffix = version[1:].partition('-')
|
|
115
|
-
if not suffix:
|
|
116
|
-
suffix = '}}}' # this puts main releases after prerelease versions
|
|
117
|
-
version_tuple = [int(x) for x in main_version.split('.')]
|
|
118
|
-
return version_tuple + [suffix]
|
|
119
|
-
|
|
120
|
-
def get_release_tags():
|
|
121
|
-
output = subprocess.check_output(['git', 'tag'], text=True)
|
|
122
|
-
return list(filter(is_release_tag, output.split('\n')))
|
|
123
|
-
|
|
124
|
-
def generate():
|
|
125
|
-
# Get all release tags.
|
|
126
|
-
versions = get_release_tags()
|
|
127
|
-
# Now sort, putting prerelease versions ahead of the corresponding release.
|
|
128
|
-
versions.sort(key=version_key)
|
|
129
|
-
|
|
130
|
-
version_metadata = collections.OrderedDict()
|
|
131
|
-
latest_by_branch = {}
|
|
132
|
-
for v in versions:
|
|
133
|
-
version_metadata[v] = version_to_metadata(v)
|
|
134
|
-
|
|
135
|
-
# Because |versions| is already sorted, we can just overwrite the entry
|
|
136
|
-
# in the latest_by_branch dictionary.
|
|
137
|
-
branch_key = tuple(version_key(v)[0:2])
|
|
138
|
-
latest_by_branch[branch_key] = v
|
|
139
|
-
|
|
140
|
-
for v in latest_by_branch.values():
|
|
141
|
-
version_metadata[v]['best'] = True
|
|
142
|
-
|
|
143
|
-
# Append nightly rather than filter for it, so that it always appears at the
|
|
144
|
-
# end of the list.
|
|
145
|
-
version_metadata['nightly'] = version_to_metadata('nightly')
|
|
146
|
-
version_metadata['nightly']['best'] = True
|
|
147
|
-
|
|
148
|
-
# Debug: uncomment to see a list of version metadata objects.
|
|
149
|
-
#for i in version_metadata.values(): print(i)
|
|
150
|
-
|
|
151
|
-
script_path = os.path.dirname(__file__)
|
|
152
|
-
template_path = os.path.join(script_path, 'templates', 'index.html')
|
|
153
|
-
output_path = os.path.join(script_path, 'static', 'index.html')
|
|
154
|
-
|
|
155
|
-
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
|
156
|
-
|
|
157
|
-
with open(template_path, 'r') as template_file:
|
|
158
|
-
with open(output_path, 'w') as output_file:
|
|
159
|
-
template = jinja2.Template(template_file.read())
|
|
160
|
-
output = template.render(versions=version_metadata.values())
|
|
161
|
-
output_file.write(output)
|
|
162
|
-
|
|
163
|
-
if __name__ == '__main__':
|
|
164
|
-
generate()
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Shaka Player Version Index - Appspot Entrypoint
|
|
2
|
-
# Copyright 2022 Google LLC
|
|
3
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
|
|
5
|
-
# In the App Engine Python 3 runtime, you must have an entrypoint, even if all
|
|
6
|
-
# content is static and no routes are defined. This seems pretty weird, and
|
|
7
|
-
# wasn't required in the Python 2 runtime.
|
|
8
|
-
|
|
9
|
-
from flask import Flask
|
|
10
|
-
|
|
11
|
-
app = Flask(__name__)
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>Shaka Player Demo - Version Index</title>
|
|
5
|
-
<style>
|
|
6
|
-
|
|
7
|
-
#background {
|
|
8
|
-
top: 0;
|
|
9
|
-
left: 0;
|
|
10
|
-
bottom: 0;
|
|
11
|
-
right: 0;
|
|
12
|
-
position: fixed;
|
|
13
|
-
z-index: -1;
|
|
14
|
-
|
|
15
|
-
background:
|
|
16
|
-
url(https://shaka-player-demo.appspot.com/assets/poster.jpg)
|
|
17
|
-
no-repeat center center fixed;
|
|
18
|
-
background-size: contain;
|
|
19
|
-
|
|
20
|
-
opacity: 0.4;
|
|
21
|
-
filter: sepia(50%);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
#links {
|
|
25
|
-
margin: 20px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
#links a {
|
|
29
|
-
margin: 0.5em;
|
|
30
|
-
padding: 0.5em;
|
|
31
|
-
|
|
32
|
-
border: 2px solid black;
|
|
33
|
-
background-color: #006;
|
|
34
|
-
|
|
35
|
-
font-size: 110%;
|
|
36
|
-
color: white;
|
|
37
|
-
font-weight: bold;
|
|
38
|
-
text-decoration: none;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
table.best tr.old {
|
|
42
|
-
display: none;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
th, td {
|
|
46
|
-
border: 1px solid black;
|
|
47
|
-
padding: 0.2em 2em;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
table.best tr.best-even,
|
|
51
|
-
table.all tr:nth-child(2n) {
|
|
52
|
-
background-color: rgba(0,0,0,0.1);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
</style>
|
|
56
|
-
<script>
|
|
57
|
-
function display(which) {
|
|
58
|
-
table.class = 'which';
|
|
59
|
-
}
|
|
60
|
-
</script>
|
|
61
|
-
</head>
|
|
62
|
-
<body>
|
|
63
|
-
<div id="background"></div>
|
|
64
|
-
|
|
65
|
-
<h1>Shaka Player release demos on appspot</h1>
|
|
66
|
-
|
|
67
|
-
<div id="links">
|
|
68
|
-
<a href="#" onclick="table.className = 'best'">Best versions</a>
|
|
69
|
-
<a href="#" onclick="table.className = 'all'">All versions</a>
|
|
70
|
-
</div>
|
|
71
|
-
|
|
72
|
-
<table id="table" class="best">
|
|
73
|
-
<tr><th>Version</th></tr>
|
|
74
|
-
{% set best_counter = 0 %}
|
|
75
|
-
{% for v in versions %}
|
|
76
|
-
{% if v.best %}
|
|
77
|
-
<tr class="best {{'best-even' if best_counter % 2 == 0 else ''}}">
|
|
78
|
-
{% set best_counter = best_counter + 1 %}
|
|
79
|
-
{% else %}
|
|
80
|
-
<tr class="old">
|
|
81
|
-
{% endif %}
|
|
82
|
-
<th>{{ v.version }}</th>
|
|
83
|
-
<td><a href="{{ v.demo }}">demo</a></td>
|
|
84
|
-
<td><a href="{{ v.lib }}">non-UI library</a></td>
|
|
85
|
-
<td>
|
|
86
|
-
{% if v.ui_lib %}
|
|
87
|
-
<a href="{{ v.ui_lib }}">UI-enabled library</a>
|
|
88
|
-
{% endif %}
|
|
89
|
-
</td>
|
|
90
|
-
<td>
|
|
91
|
-
{% if v.lib_externs %}
|
|
92
|
-
<a href="{{ v.lib_externs }}">non-UI externs</a>
|
|
93
|
-
{% endif %}
|
|
94
|
-
</td>
|
|
95
|
-
<td>
|
|
96
|
-
{% if v.ui_lib_externs %}
|
|
97
|
-
<a href="{{ v.ui_lib_externs }}">UI-enabled externs</a>
|
|
98
|
-
{% endif %}
|
|
99
|
-
</td>
|
|
100
|
-
<td>
|
|
101
|
-
{% if v.lib_defs %}
|
|
102
|
-
<a href="{{ v.lib_defs }}">non-UI typescript defs</a>
|
|
103
|
-
{% endif %}
|
|
104
|
-
</td>
|
|
105
|
-
<td>
|
|
106
|
-
{% if v.ui_lib_defs %}
|
|
107
|
-
<a href="{{ v.ui_lib_defs }}">UI-enabled typescript defs</a>
|
|
108
|
-
{% endif %}
|
|
109
|
-
</td>
|
|
110
|
-
</tr>
|
|
111
|
-
{% endfor %}
|
|
112
|
-
</table>
|
|
113
|
-
</body>
|
|
114
|
-
</html>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Google App Engine Demo
|
|
2
|
-
|
|
3
|
-
This folder contains everything necessary to host our demo on
|
|
4
|
-
https://shaka-player-demo.appspot.com/
|
|
5
|
-
|
|
6
|
-
- app.yaml: App Engine config file. Defines cache expiration and how specific
|
|
7
|
-
URLs are mapped to specific files.
|
|
8
|
-
|
|
9
|
-
- main.py: A catch-all python service to serve any non-static files. This
|
|
10
|
-
handles HTTP redirects for the root path (this is the only way to
|
|
11
|
-
do HTTP redirects in App Engine) and the poster service (which
|
|
12
|
-
returns special poster images on certain days).
|
|
13
|
-
|
|
14
|
-
- requirements.txt: Used by App Engine to install the necessary Python server
|
|
15
|
-
requirements (Flask).
|
|
16
|
-
|
|
17
|
-
- time.txt: A static file used for time sync in the client. Configured with
|
|
18
|
-
special response headers for cross-origin access.
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# Copyright 2016 Google LLC
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
runtime: python39
|
|
16
|
-
default_expiration: 5m
|
|
17
|
-
|
|
18
|
-
handlers:
|
|
19
|
-
# A static file used for clock sync in the demo app
|
|
20
|
-
- url: /time.txt
|
|
21
|
-
static_files: time.txt
|
|
22
|
-
upload: time.txt
|
|
23
|
-
expiration: 0
|
|
24
|
-
http_headers:
|
|
25
|
-
Access-Control-Allow-Origin: "*"
|
|
26
|
-
Access-Control-Allow-Headers: "If-Modified-Since,Range,Origin"
|
|
27
|
-
Access-Control-Expose-Headers: "Date"
|
|
28
|
-
Access-Control-Max-Age: "2592000"
|
|
29
|
-
|
|
30
|
-
# These used to exist in the repo, but have been generated server-side for many
|
|
31
|
-
# years now.
|
|
32
|
-
- url: /assets/poster.jpg
|
|
33
|
-
script: auto
|
|
34
|
-
- url: /assets/audioOnly.gif
|
|
35
|
-
script: auto
|
|
36
|
-
|
|
37
|
-
# Serve favicon.ico from the demo folder.
|
|
38
|
-
- url: /favicon.ico
|
|
39
|
-
secure: always
|
|
40
|
-
static_files: demo/favicon.ico
|
|
41
|
-
upload: demo/favicon.ico
|
|
42
|
-
|
|
43
|
-
# For these folders, serve their indexes.
|
|
44
|
-
- url: /docs/api/
|
|
45
|
-
secure: always
|
|
46
|
-
static_files: docs/api/index.html
|
|
47
|
-
upload: docs/api/index.html
|
|
48
|
-
- url: /demo/
|
|
49
|
-
secure: always
|
|
50
|
-
static_files: demo/index.html
|
|
51
|
-
upload: demo/index.html
|
|
52
|
-
- url: /demo/
|
|
53
|
-
secure: always
|
|
54
|
-
static_files: demo/index.html
|
|
55
|
-
upload: demo/index.html
|
|
56
|
-
|
|
57
|
-
# Serve everything else directly.
|
|
58
|
-
- url: /(.+)
|
|
59
|
-
secure: always
|
|
60
|
-
static_files: \1
|
|
61
|
-
upload: .+
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# Shaka Player Demo - Appspot Entrypoint
|
|
2
|
-
# Copyright 2022 Google LLC
|
|
3
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
|
|
5
|
-
# Most of the app is served as static content. Any exceptions go here.
|
|
6
|
-
|
|
7
|
-
import datetime
|
|
8
|
-
import os
|
|
9
|
-
|
|
10
|
-
from flask import Flask, make_response, redirect, request, send_file
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
app = Flask(__name__)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# Redirect root requests to /demo.
|
|
17
|
-
@app.route('/')
|
|
18
|
-
def root():
|
|
19
|
-
return redirect('/demo/', code=302)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# A Doodle-like service to change the poster on certain days.
|
|
23
|
-
# All posters are chosen based on the current date in PST.
|
|
24
|
-
|
|
25
|
-
from posters import VIDEO_POSTERS, VIDEO_DEFAULT, AUDIO_POSTERS, AUDIO_DEFAULT
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# Timezone info for PST.
|
|
29
|
-
# I'm ignoring DST to avoid complicating the code.
|
|
30
|
-
class PST(datetime.tzinfo):
|
|
31
|
-
def utcoffset(self, dt):
|
|
32
|
-
return datetime.timedelta(hours=-8)
|
|
33
|
-
|
|
34
|
-
def dst(self, dt):
|
|
35
|
-
return datetime.timedelta(0)
|
|
36
|
-
|
|
37
|
-
def tzname(self, dt):
|
|
38
|
-
return 'PST'
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def get_poster(poster_map, default_poster):
|
|
42
|
-
now = datetime.datetime.now(PST())
|
|
43
|
-
today = (now.month, now.day)
|
|
44
|
-
today_with_year = (now.month, now.day, now.year)
|
|
45
|
-
midnight = datetime.datetime(now.year, now.month, now.day, tzinfo=PST())
|
|
46
|
-
local_expiration = midnight + datetime.timedelta(days=1)
|
|
47
|
-
max_age = (local_expiration - now).total_seconds()
|
|
48
|
-
|
|
49
|
-
# For internal debugging and testing of the poster service, we can override
|
|
50
|
-
# the date. To set an override, open /assets/poster.jpg and run this in the
|
|
51
|
-
# JS console:
|
|
52
|
-
# document.cookie="posterdate=10-31"
|
|
53
|
-
# To clear an override, run:
|
|
54
|
-
# document.cookie="posterdate="
|
|
55
|
-
override = request.cookies.get('posterdate')
|
|
56
|
-
if override:
|
|
57
|
-
override_tuple = [int(x) for x in override.split('-')]
|
|
58
|
-
print('Date override:', repr(override_tuple))
|
|
59
|
-
|
|
60
|
-
if len(override_tuple) == 3:
|
|
61
|
-
# Override includes year.
|
|
62
|
-
today_with_year = tuple(override_tuple)
|
|
63
|
-
today = tuple(override_tuple[0:2])
|
|
64
|
-
elif len(override_tuple) == 2:
|
|
65
|
-
# Override does not include year, so add the current year.
|
|
66
|
-
today_with_year = tuple(override_tuple + [now.year])
|
|
67
|
-
today = tuple(override_tuple)
|
|
68
|
-
else:
|
|
69
|
-
# Bad override format. Ignore the year, but add a response header to
|
|
70
|
-
# indicate that the override failed. For internal debugging of the
|
|
71
|
-
# poster service.
|
|
72
|
-
print('Bad date override:', override, file=sys.stderr)
|
|
73
|
-
|
|
74
|
-
# Prefer a poster for this specific year.
|
|
75
|
-
name = poster_map.get(today_with_year, poster_map.get(today, default_poster))
|
|
76
|
-
path = 'posters/%s' % name
|
|
77
|
-
|
|
78
|
-
response = make_response(
|
|
79
|
-
send_file(path, last_modified=midnight, max_age=max_age))
|
|
80
|
-
|
|
81
|
-
response.headers['Access-Control-Allow-Origin'] = '*'
|
|
82
|
-
response.headers['Access-Control-Allow-Headers'] = 'If-Modified-Since,Range'
|
|
83
|
-
response.headers['Access-Control-Expose-Headers'] = 'Date'
|
|
84
|
-
response.headers['Access-Control-Max-Age'] = '2592000'
|
|
85
|
-
|
|
86
|
-
return response
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
@app.route('/assets/poster.jpg')
|
|
90
|
-
def get_video_poster():
|
|
91
|
-
return get_poster(VIDEO_POSTERS, VIDEO_DEFAULT)
|
|
92
|
-
|
|
93
|
-
@app.route('/assets/audioOnly.gif')
|
|
94
|
-
def get_audio_poster():
|
|
95
|
-
return get_poster(AUDIO_POSTERS, AUDIO_DEFAULT)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|