-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
463 lines (425 loc) · 13.6 KB
/
index.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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Home</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Home</h1>
<h3> </h3>
<section>
<article><h1><strong>fjplayer.js</strong></h1>
<p><a href="https://app.fossa.com/projects/git%2Bgit.luolix.top%2Fmedazzo%2Ffjplayer?ref=badge_shield"><img src="https://app.fossa.com/api/projects/git%2Bgit.luolix.top%2Fmedazzo%2Ffjplayer.svg?type=shield" alt="FOSSA Status"></a>
<a href="https://travis-ci.com/medazzo/fjplayer"><img src="https://travis-ci.com/medazzo/fjplayer.svg?branch=master" alt="Build Status"></a>
<a href="https://badge.fury.io/js/fjplayer"><img src="https://badge.fury.io/js/fjplayer.svg" alt="npm version"></a></p>
<h1><strong>fjplayer</strong></h1>
<h2>What is fjplayer</h2>
<ul>
<li>it's a 100 % customiazble video player base on html 5 video Player</li>
<li>it's support dash and mp4 sources</li>
<li>it support multi subs tracks</li>
<li>it support overlays ads and any information overlays</li>
<li>it support injection mp4 video ads in preroll,modroll or after rolling main video</li>
<li>based on sdhakla player</li>
</ul>
<h2>Using fjplayer</h2>
<h3>include fjplayer file</h3>
<p><strong>dist/fjplayer.js</strong> for fjplayer styles and javascript code , no other dependecies is needed</p>
<pre class="prettyprint source lang-html"><code><script type="text/javascript" src="/dist/fjplayer.min.js"></script>
</code></pre>
<h3>html</h3>
<p>In your html code , you need to add a div with a an Id to be used bu the player</p>
<pre class="prettyprint source lang-html"><code><div id="playercontainer">
</div>
</code></pre>
<h3>java script coding</h3>
<p>In order to create a player and use , we need to create a playlist first :</p>
<pre class="prettyprint source lang-javascript"><code>var playlist = new fjplayer.Playlist();
</code></pre>
<p>Then specify one or more elements and add them to the playlist</p>
<pre class="prettyprint source lang-javascript"><code> var forjaItemDashEncryptedWithPreAds = {
'FJType': 'dash',
'FJTitle': 'clear Forja movie itemDash ',
'FJClass': 'vod',
'FJSrc': 'http://127.0.0.1:8500/dashedCrypted/stream.mpd',
'FJDrm': {
"FjLicenseServer": "http://127.0.0.1:3000"
},
'FJAds': [{
'FJType': 'video/mp4',
'FJSrc': '../videos/berber_pub.mp4',
'FJClass': 'pre-roll',
'FJCanEscape': true,
'FJUrl': 'http://www.google.com'
}]
};
var Mp4SubsWithThumbs = {
'FJSrc': 'https://content.jwplatform.com/videos/q1fx20VZ-kNspJqnJ.mp4',
'FJTitle': ' title of movie itemOnly 1',
'FJClass': 'vod',
'FJThumbs': '../vtt/thumbs.vtt',
'FJType': 'video/mp4',
'FJSubtitles': [{
'FJLabel': 'English',
'FJLang': 'en',
'FJSrc': '../vtt/sintel-en.vtt'
}, {
'FJLabel': 'Espagnol',
'FJLang': 'es',
'FJSrc': '../vtt/sintel-es.vtt'
}, {
'FJLabel': 'Deutsch',
'FJLang': 'de',
'FJSrc': '../vtt/sintel-de.vtt'
}]
};
var clearSteam = {
'FJType': 'dash',
'FJTitle': 'clear Forja movie itemDash ',
'FJClass': 'vod',
'FJSrc': 'http://127.0.0.1:8500/bclear/stream.mpd'
}
playlist.addItem(Mp4SubsWithThumbs);
playlist.addItem(clearSteam);
</code></pre>
<p>Now , you can create player where first argument is the playerKey and the second is the id of the div container in html and load the playlist;</p>
<pre class="prettyprint source lang-javascript"><code>var player = new fjplayer.Player('fjserverID1', 'playercontainer');
player.loadPlaylist(playlist);
</code></pre>
<p>You can also add event listener ;</p>
<pre class="prettyprint source lang-javascript"><code> function fjplayerEvent(e, args) {
console.warn(" We are having an event : ", e, args);
};
player.on(fjplayer.PlayerEvents.STREAM_LOADED, fjplayerEvent);
</code></pre>
<p>Finally, you can start playing , in this example we start play at element 0, looping is true , random play id false and autostart is true ;</p>
<pre class="prettyprint source lang-javascript"><code>player.startPlaylist(0, true, false, true);
</code></pre>
<h3>fjplayer Developing</h3>
<h4>Setup</h4>
<pre class="prettyprint source"><code>cd fjplayer
npm install
</code></pre>
<h4>Build min files</h4>
<pre class="prettyprint source"><code>npm run build
</code></pre>
<h4>Test</h4>
<p>Tests are run with Jest and Karma, to run tests :</p>
<pre class="prettyprint source"><code>npm test
</code></pre>
<p>You can run tests with coverage or tests while watchinf code sources changes :</p>
<pre class="prettyprint source"><code>npm run test:coverage
npm run test:watch
</code></pre>
<p>At the end of the run , result of coverage will be displayed.</p>
<h4>Build docs</h4>
<p>To build docs , run :</p>
<pre class="prettyprint source"><code>npm run doc
</code></pre>
<p>Docs will be generated under <strong>docs/generated</strong>, <a href="docs/generated/index.html">use browser on the index file</a> :</p>
<pre class="prettyprint source"><code>firefox docs/generated/index.html
</code></pre>
<h4>Run demo</h4>
<p>To run http demo and developiong watching mode for javascript code :</p>
<pre class="prettyprint source"><code>npm run live
</code></pre>
<p>Demo app will be launched at http://localhost:8080</p>
<h3>Playlist Item</h3>
<p>A Playlist item will contains theses elements :</p>
<table>
<thead>
<tr>
<th>item field</th>
<th>mandatory</th>
<th>value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>FJClass</td>
<td>YES</td>
<td>'vod' or 'live'</td>
<td>the class of the stream</td>
</tr>
<tr>
<td>FJType</td>
<td>YES</td>
<td>'video/mp4' or 'dash'</td>
<td>the type of the stream</td>
</tr>
<tr>
<td>FJTitle</td>
<td>YES</td>
<td>non empty string</td>
<td>the title to be shown when playing</td>
</tr>
<tr>
<td>FJSrc</td>
<td>YES</td>
<td>non empty url string</td>
<td>the url of the stream to be played</td>
</tr>
<tr>
<td>FJDownload</td>
<td>NO</td>
<td>non empty url string</td>
<td>activate download icon and open new widown on url when icon is clicked</td>
</tr>
<tr>
<td>FJShare</td>
<td>NO</td>
<td>non empty url string</td>
<td>activate share icon and open new widown on url when icon is clicked</td>
</tr>
<tr>
<td>FJBack</td>
<td>NO</td>
<td>non empty url string</td>
<td>activate back arow icon and locate current window to url when icon is clicked</td>
</tr>
<tr>
<td>FJUpTitle</td>
<td>NO</td>
<td>boolean</td>
<td>show of not the title in player up</td>
</tr>
<tr>
<td>FJSrc</td>
<td>YES</td>
<td>non empty url string</td>
<td>the url of the stream to be played</td>
</tr>
<tr>
<td>FJDrm</td>
<td>NO</td>
<td>integer</td>
<td>it's an object containing drm security information</td>
</tr>
<tr>
<td>FJPoster</td>
<td>NO</td>
<td>url to image poster</td>
<td>url to poster to be showing wen loading</td>
</tr>
<tr>
<td>FJThumbs</td>
<td>NO</td>
<td>url to image thumbs</td>
<td>url to file containing tooltip thumbnail images for video associated with WebVTT : to generate this file you can visit <a href="https://github.com/vlanard/videoscripts">github video scripts</a></td>
</tr>
<tr>
<td>FJSubtitles</td>
<td>NO</td>
<td>array of subtitles Items</td>
<td></td>
</tr>
<tr>
<td>FJAds</td>
<td>NO</td>
<td>array of video ads Items</td>
<td></td>
</tr>
<tr>
<td>FJOverlays</td>
<td>NO</td>
<td>array of overlays Items</td>
<td></td>
</tr>
</tbody>
</table>
<h3>fjplayer <em>ads</em></h3>
<p>The object ads , must be inserted on array <strong>FJAds</strong> under item on playlist.
The Ads is referring to advertissment.
When it's time to play this ads , fjplayer will pause main video hide the controls , play the Ads and show a transparent banner up on which the countdown timer before the ads ends.</p>
<p>Ads also contains :</p>
<table>
<thead>
<tr>
<th>ads item field</th>
<th>mandatory</th>
<th>value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>FJType</td>
<td>YES</td>
<td>'video/mp4' or 'dash'</td>
<td>the type of the stream</td>
</tr>
<tr>
<td>FJSrc</td>
<td>YES</td>
<td>non empty url string</td>
<td>the url of the stream to be played</td>
</tr>
<tr>
<td>FJClass</td>
<td>YES</td>
<td>'pre-roll' , 'mid-roll' or 'post-roll'</td>
<td>pre: before main video, mid: in the middle and post: after the main video</td>
</tr>
<tr>
<td>FJCanEscape</td>
<td>YES</td>
<td>boolean</td>
<td>display a button to escape ads or not</td>
</tr>
<tr>
<td>FJFJUrlSrc</td>
<td>YES</td>
<td>non empty url string</td>
<td>the url of the advertiser, when user click on video when ads playing , a windows will be opened on this url</td>
</tr>
<tr>
<td>FJShowAt</td>
<td>YES (mid-roll)</td>
<td>integer</td>
<td>the number of seconds use to start the Ads if it mid-roll class</td>
</tr>
</tbody>
</table>
<p>if <strong>FJShowAt</strong> is negatif or bigger than ads duration , then the concerned ads wil not be player.</p>
<h3>fjplayer <em>subtitle</em></h3>
<p>The object subtitle , must be inserted on array <strong>FJSubtitles</strong> under item on playlist.
It permit to add a webvtt subtitles other that existing in mpd (in case of dash ) .
it contains :</p>
<table>
<thead>
<tr>
<th>subtitle field</th>
<th>mandatory</th>
<th>value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>FJLabel</td>
<td>YES</td>
<td>non empty string</td>
<td>string label of subtitles to be shown on control</td>
</tr>
<tr>
<td>FJSrc</td>
<td>YES</td>
<td>non empty url string</td>
<td>url of the web vtt subtitles file</td>
</tr>
<tr>
<td>FJLang</td>
<td>YES</td>
<td>fr or en or de ...</td>
<td>ISO descripton of language</td>
</tr>
</tbody>
</table>
<h3>fjplayer <em>overlay</em></h3>
<p>The object overlay , must be inserted on array <strong>FJOverlays</strong> under item on playlist.
An overlay is a graphic layer above the video layer that conatains data like ads data.
When user lick on an overlay a new opened will be opened with the url <strong>FJOverUrl</strong>.
Ii will be showing at <strong>FJOverShowAt</strong> and for a duration of <strong>FJOverDuration</strong> .
If <strong>FJOverShowAt</strong> or <strong>FJOverShowAt</strong>+<strong>FJOverDuration</strong> is bigger than the item movie duration, then the overlays will not be schown at all .
it contains :</p>
<table>
<thead>
<tr>
<th>overlay field</th>
<th>mandatory</th>
<th>value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>FJData</td>
<td>YES</td>
<td>non empty string</td>
<td>html data that will be putted on div overlay</td>
</tr>
<tr>
<td>FJUrl</td>
<td>YES</td>
<td>non empty url string</td>
<td>url to open in new window to when the user click on overlay</td>
</tr>
<tr>
<td>FJDuration</td>
<td>YES</td>
<td>integer</td>
<td>in seconds , the duration of overlay show</td>
</tr>
<tr>
<td>FJShowAt</td>
<td>YES</td>
<td>integer</td>
<td>in seconds , the time in video to start to schow the overlay</td>
</tr>
</tbody>
</table>
<h3>fjplayer <em>drm</em></h3>
<p><em>This part of specs is not supported yet by player</em>
The object drm , is referring to Digital right managment and it's contains data about media drm .
This object is managed onlywhen <strong>FJType</strong> is <em>dash</em> .
It must be in <strong>FJDrm</strong> field
it contains :</p>
<table>
<thead>
<tr>
<th>drm field</th>
<th>mandatory</th>
<th>value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>FJDrmScheme</td>
<td>YES</td>
<td>'forja','playReady,'clearKey' or 'widevine'</td>
<td>drm Scheme to use</td>
</tr>
<tr>
<td>FJLicenceServer</td>
<td>YES</td>
<td>non empty url string</td>
<td>url of the Licensing server</td>
</tr>
<tr>
<td>FJHeadersOnLicenseRequest</td>
<td>NO</td>
<td>object contains headers and value</td>
<td>headers and value to be add to request when asking for license</td>
</tr>
<tr>
<td>FJHeadersOnSegmentsRequest</td>
<td>NO</td>
<td>object contains headers and value</td>
<td>headers and value to be add to request when asking for segment</td>
</tr>
</tbody>
</table>
<p>The Drm scheme <strong>fjserver</strong> is a clear key based scheme done on <strong>fjserver</strong> .</p></article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-AdsManager.html">AdsManager</a></li><li><a href="module-Constants.html">Constants</a></li><li><a href="module-Eventing.html">Eventing</a></li><li><a href="module-FjseAuthz.html">FjseAuthz</a></li><li><a href="module-Logger.html">Logger</a></li><li><a href="module-Overlay.html">Overlay</a></li><li><a href="module-PlayerMedia.html">PlayerMedia</a></li><li><a href="module-playerTemplate.html">playerTemplate</a></li><li><a href="module-PlayerUi.html">PlayerUi</a></li><li><a href="module-Thumbs.html">Thumbs</a></li></ul><h3>Classes</h3><ul><li><a href="Menus.html">Menus</a></li><li><a href="Player.html">Player</a></li><li><a href="global.html#Playlist">Playlist</a></li><li><a href="Version.html">Version</a></li></ul><h3>Global</h3><ul><li><a href="global.html#IsoLangs">IsoLangs</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Thu Jan 06 2022 00:18:08 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>