forked from shaka-project/shaka-player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev.html
235 lines (196 loc) · 7.95 KB
/
dev.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<!--
Copyright 2014 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<h3 class="tutorial-heading">
Quick Setup (TL;DR)
</h3>
<p>
To get started quickly, just run ./build/all.sh and skip this document.
</p>
<h3 class="tutorial-heading">
Checking Out a Specific Release
</h3>
<p>
You can check out a specific release version after cloning the repository. Just
use "git checkout" followed by a release, such as "git checkout v1.2.0".
</p>
<h3 class="tutorial-heading">
Closure, Annotations, and the Build Process
</h3>
<p>
The Shaka Player library was designed to be compiled with Google's open-sourced
JavaScript compiler, {@link http://goo.gl/HZfHi Closure}. The Closure compiler
produces JavaScript code which is minified, optimized, obfuscated, and stripped
of dead code. Deploying a Closure-compiled JavaScript library saves bandwidth,
and the browser can also load and parse the code faster.
</p>
<p>
Closure also enforces structure and type-safety on the JavaScript language. It
allows developers to annotate code with type information. The compiler can use
this information to optimize the code, but it also helps catch bugs early, such
as missing arguments, arguments of the wrong type, typos in names, etc.
</p>
<p>
The annotation syntax is derived from {@link http://usejsdoc.org/ JSDoc}. This
means that the annotated code is also self-documenting. We generate docs based
on these annotations using JSDoc. For information on annotation syntax, please
refer to {@link http://goo.gl/xxHG2W Annotating JavaScript} on Closure's site.
</p>
<p>
The Closure compiler and JSDoc are both included in the source. To compile the
Shaka Player library, simply run ./build/all.sh from the source root. Compiled
JavaScript will be output to shaka-player.compiled.js in the source root.
</p>
<p>
To generate documentation, run ./build/docs.sh from the source root. Docs will
be output to ./docs/api/ in HTML format.
</p>
<h3 class="tutorial-heading">
The Test App
</h3>
<p>
The project includes a test application which we used for manual testing during
development. The test app is made up of index.html, index.css, and app.js, and
can be accessed by pointing a web server at your source code checkout.
</p>
<p>
Many of the settings in the test app can be controlled with URL parameters such
that the page can be reloaded without the need to manually change settings. To
see a canonical list of URL parameters, see app.js.
</p>
<p>
Some parameters require a value, but most are boolean. The behavior of boolean
parameters is activated by presence. Parameters are separated by semicolons.
<ul>
<li>lang=LANG - Changes the language preference fed to the library. Language
settings use language tags from {@link http://goo.gl/J6yQvS BCP 47}, such
as "en", "en-US', "fr-CA", "el", "deu-AT", etc.</li>
<li>nocenc - Select the non-encrypted version of the default sample.</li>
<li>vp9 - Select a VP9 DASH sample.</li>
<li>dash - Auto-play the selected DASH stream.</li>
<li>compiled - Load the library in compiled mode. See "Loader" below.</li>
<li>debug - Set the log level to show debug messages.</li>
<li>v - Set the log level to show debug and verbose messages.</li>
</ul>
</p>
<p>
Example URLs for the test app:
<ul>
<li>http://localhost/shaka/?nocenc
<ul><li>Defaults the UI to a non-encrypted sample.</li></ul>
</li>
<li>http://localhost/shaka/?dash;vp9
<ul><li>Selects the VP9 sample and auto-plays it.</li></ul>
</li>
<li>http://localhost/shaka/?dash;lang=fr
<ul><li>Sets the language to French and auto-plays.</li></ul>
</li>
<li>http://localhost/shaka/?compiled;dash
<ul><li>Auto-plays the default sample in compiled mode.</li></ul>
</li>
</ul>
</p>
<h3 class="tutorial-heading">
The Loader
</h3>
<p>
The Shaka Player library can be used without compiling it. This is useful when
making changes, since it shortens the testing cycle for the developer. But the
library will be deployed in a compiled form, so it is critical to test a change
using the compiled library once it has been vetted uncompiled.
</p>
<p>
To make it easier to switch between compiled and uncompiled mode during testing
and development, load.js acts as a shim between index.html and the library. It
will select which version of the library to load based on the boolean parameter
"compiled". (See "Test App" above for info on parameters.)
</p>
<p>
At any time during development or testing, you can switch modes by changing the
URL. Once the application has loaded, you cannot change modes without reloading
the page. A production application would directly include the compiled library
instead of using this loader.
</p>
<p>
Remember, when running in compiled mode, you must recompile the library after a
change by running ./build/all.sh.
</p>
<h3 class="tutorial-heading">
Tests
</h3>
<p>
Tests live in the "spec" folder and are run by spec_runner.html. To run tests,
just point your browser at this HTML file. Do not do this using a file:// URL,
but through a local web server.
</p>
<h3 class="tutorial-heading">
Source Code Layout
</h3>
<p>
<ul>
<li>assets/ - assets for smoke-testing basic functionality</li>
<li>build/ - build scripts
<ul>
<li>build.sh - compiles the library and generates
shaka-player.compiled.js</li>
<li>gendeps.sh - computes dependencies for running non-compiled code</li>
<li>lint.sh - checks the code for style issues</li>
<li>all.sh - combination of gendeps.sh, build.sh, and lint.sh</li>
<li>docs.sh - generate documentation</li>
</ul>
</li>
<li>docs/ - documentation
<ul>
<li>api/ - generated documentation</li>
<li>reference/ - reference documents</li>
</ul>
</li>
<li>externs/ - definitions of external APIs, used by the compiler</li>
<li>lib/ - the Shaka Player Library source, organized by namespace
<ul>
<li>dash/ - DASH-related classes (internal)</li>
<li>debug/ - debug-related classes (internal)</li>
<li>media/ - generic media-related and MSE-related classes (internal)</li>
<li>player/ - all classes that an integrator must interact with</li>
<li>polyfill/ - all {@tutorial polyfills}</li>
<li>util/ - utility classes (internal)</li>
</ul>
</li>
<li>spec/ - unit and integration tests</li>
<li>spec_runner.html - front-end to run unit and integration tests</li>
<li>support.html - browser API support test</li>
<li>third_party/ - third_party dependencies
<ul>
<li>SUMMARY.txt - summary of all libraries and their licenses</li>
<li>blanket_jasmine/ - Blanket JS coverage library</li>
<li>closure/ - Closure JS compiler and JS library</li>
<li>jasmine/ - Jasmine JS testing framework</li>
<li>jsdoc/ - JS documentation generator</li>
</ul>
</li>
<li>tutorials/ - source code for these tutorials</li>
<br>
<li>app.js - manual testing/sample application (JS)</li>
<li>index.html - manual testing/sample application (HTML)</li>
<li>index.css - manual testing/sample application (CSS)</li>
<li>load.js - library loader (for testing/bootstrapping)</li>
<br>
<li>jsdoc.conf.json - configuration for generating documentation</li>
<li>shaka-player.compiled.js - compiler output (suitable for deployment)</li>
<li>shaka-player.compiled.debug.js - compiler output (with debugging enabled
via source map)</li>
<li>shaka-player.compiled.debug.map - compiler output
({@link http://goo.gl/5xQEy source map})</li>
<li>shaka-player.uncompiled.js - requires all exported classes in uncompiled
mode</li>
</ul>
</p>