shaka-player 4.0.3 → 4.0.4
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/CHANGELOG.md +13 -0
- package/CONTRIBUTORS +2 -0
- package/README.md +20 -6
- package/demo/index.html +0 -2
- package/dist/controls.css +1 -1
- package/dist/deps.js +3 -3
- package/dist/locales.js +33 -33
- package/dist/shaka-player.compiled.d.ts +11 -0
- package/dist/shaka-player.compiled.debug.d.ts +11 -0
- package/dist/shaka-player.compiled.debug.externs.js +48 -37
- package/dist/shaka-player.compiled.debug.js +141 -137
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +48 -37
- package/dist/shaka-player.compiled.js +774 -772
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +11 -0
- package/dist/shaka-player.ui.debug.d.ts +11 -0
- package/dist/shaka-player.ui.debug.externs.js +48 -37
- package/dist/shaka-player.ui.debug.js +153 -149
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +48 -37
- package/dist/shaka-player.ui.js +892 -890
- package/dist/shaka-player.ui.map +4 -4
- package/docs/tutorials/upgrade.md +1 -0
- package/docs/tutorials/welcome.md +6 -3
- package/lib/dash/dash_parser.js +5 -0
- package/lib/hls/hls_parser.js +6 -2
- package/lib/media/media_source_engine.js +57 -24
- package/lib/media/presentation_timeline.js +24 -1
- package/lib/media/streaming_engine.js +3 -4
- package/lib/media/time_ranges_utils.js +46 -0
- package/lib/player.js +1 -1
- package/lib/polyfill/media_capabilities.js +3 -0
- package/lib/polyfill/videoplaybackquality.js +3 -1
- package/lib/util/platform.js +19 -1
- package/lib/util/string_utils.js +56 -14
- package/maintained-branches.md +15 -0
- package/package.json +2 -4
- 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/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
|
@@ -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
|
|
Binary file
|
|
Binary file
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
Trek poster image derived from:
|
|
2
|
-
https://commons.wikimedia.org/wiki/File:Leonard_Nimoy_by_Gage_Skidmore_2.jpg
|
|
3
|
-
Author:
|
|
4
|
-
https://commons.wikimedia.org/wiki/User:Gage
|
|
5
|
-
License:
|
|
6
|
-
Creative Commons Share-Alike 3.0
|
|
7
|
-
http://creativecommons.org/licenses/by-sa/3.0/
|
|
8
|
-
|
|
9
|
-
Zombie poster image derived from:
|
|
10
|
-
https://www.flickr.com/photos/ofsmallthings/8055153041
|
|
11
|
-
Author:
|
|
12
|
-
https://www.flickr.com/photos/ofsmallthings/
|
|
13
|
-
License:
|
|
14
|
-
Creative Commons Share-Alike 2.0
|
|
15
|
-
https://creativecommons.org/licenses/by-sa/2.0/
|
|
16
|
-
|
|
17
|
-
Color bars April Fool's image from:
|
|
18
|
-
http://kittypizzadope.tumblr.com/post/66751567701
|
|
19
|
-
Author:
|
|
20
|
-
unknown
|
|
21
|
-
License:
|
|
22
|
-
unknown
|
|
23
|
-
|
|
24
|
-
Party hat image from:
|
|
25
|
-
https://pixabay.com/en/party-hat-celebration-birthday-42329/
|
|
26
|
-
Author:
|
|
27
|
-
unknown
|
|
28
|
-
License:
|
|
29
|
-
Creative Commons 0 - Public Domain 1.0
|
|
30
|
-
https://creativecommons.org/publicdomain/zero/1.0/deed.en
|
|
31
|
-
|
|
32
|
-
Party streamers image from:
|
|
33
|
-
https://pixabay.com/en/confetti-streamer-party-carnival-1925258/
|
|
34
|
-
Author:
|
|
35
|
-
Unknown
|
|
36
|
-
License:
|
|
37
|
-
Creative Commons 0 - Public Domain 1.0
|
|
38
|
-
https://creativecommons.org/publicdomain/zero/1.0/deed.en
|
|
39
|
-
|
|
40
|
-
Fireworks image from:
|
|
41
|
-
https://pixabay.com/illustrations/fireworks-sylvester-pyrotechnics-2248223/
|
|
42
|
-
Author:
|
|
43
|
-
https://pixabay.com/users/geralt-9301/
|
|
44
|
-
License:
|
|
45
|
-
Simplified Pixabay License
|
|
46
|
-
https://pixabay.com/service/license/
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|