@mediakind/mkplayer 1.0.10 → 1.0.12
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/README.md +22 -10
- package/azure-pipelines.yml +1 -16
- package/dist/MKPlayer.d.ts +3 -0
- package/dist/MKPlayerConfiguration.d.ts +3 -0
- package/dist/events/MKEvent.d.ts +4 -1
- package/dist/index.d.ts +2 -0
- package/dist/lib/MKPlayer.d.ts +3 -0
- package/dist/lib/MKPlayer.js +48 -19
- package/dist/lib/MKPlayer.js.map +1 -1
- package/dist/lib/MKPlayerConfiguration.d.ts +3 -0
- package/dist/lib/events/MKEvent.d.ts +4 -1
- package/dist/lib/events/MKEvent.js +3 -0
- package/dist/lib/events/MKEvent.js.map +1 -1
- package/dist/lib-esm/MKPlayer.d.ts +3 -0
- package/dist/lib-esm/MKPlayer.js +49 -20
- package/dist/lib-esm/MKPlayer.js.map +1 -1
- package/dist/lib-esm/MKPlayerConfiguration.d.ts +3 -0
- package/dist/lib-esm/events/MKEvent.d.ts +4 -1
- package/dist/lib-esm/events/MKEvent.js +3 -0
- package/dist/lib-esm/events/MKEvent.js.map +1 -1
- package/dist/mkplayer.js +1 -1
- package/doc/assets/js/search.json +1 -1
- package/doc/classes/mkplayer.html +100 -14
- package/doc/enums/mkevent.html +52 -10
- package/doc/index.html +22 -10
- package/doc/interfaces/mkplayerconfiguration.html +57 -0
- package/index.html +83 -26
- package/mkplayer-ui.js +12052 -0
- package/multi-camera.html +391 -0
- package/package.json +3 -3
- package/src/MKPlayer.ts +65 -24
- package/src/MKPlayerConfiguration.ts +15 -0
- package/src/events/MKEvent.ts +3 -0
- package/mkplayer.zip +0 -0
|
@@ -88,8 +88,11 @@
|
|
|
88
88
|
<ul class="tsd-index-list">
|
|
89
89
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="mkplayerconfiguration.html#autoplay" class="tsd-kind-icon">autoplay</a></li>
|
|
90
90
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="mkplayerconfiguration.html#debug" class="tsd-kind-icon">debug</a></li>
|
|
91
|
+
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="mkplayerconfiguration.html#key" class="tsd-kind-icon">key</a></li>
|
|
91
92
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="mkplayerconfiguration.html#muted" class="tsd-kind-icon">muted</a></li>
|
|
92
93
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="mkplayerconfiguration.html#smallscreen" class="tsd-kind-icon">small<wbr>Screen</a></li>
|
|
94
|
+
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="mkplayerconfiguration.html#targetlatency" class="tsd-kind-icon">target<wbr>Latency</a></li>
|
|
95
|
+
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="mkplayerconfiguration.html#ui" class="tsd-kind-icon">ui</a></li>
|
|
93
96
|
</ul>
|
|
94
97
|
</section>
|
|
95
98
|
</div>
|
|
@@ -127,6 +130,21 @@
|
|
|
127
130
|
</div>
|
|
128
131
|
</div>
|
|
129
132
|
</section>
|
|
133
|
+
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
|
134
|
+
<a name="key" class="tsd-anchor"></a>
|
|
135
|
+
<h3>key</h3>
|
|
136
|
+
<div class="tsd-signature tsd-kind-icon">key<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
|
137
|
+
<aside class="tsd-sources">
|
|
138
|
+
<ul>
|
|
139
|
+
<li>Defined in MKPlayerConfiguration.ts:38</li>
|
|
140
|
+
</ul>
|
|
141
|
+
</aside>
|
|
142
|
+
<div class="tsd-comment tsd-typography">
|
|
143
|
+
<div class="lead">
|
|
144
|
+
<p>license key for the video player</p>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
</section>
|
|
130
148
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
|
131
149
|
<a name="muted" class="tsd-anchor"></a>
|
|
132
150
|
<h3>muted</h3>
|
|
@@ -157,6 +175,36 @@
|
|
|
157
175
|
</div>
|
|
158
176
|
</div>
|
|
159
177
|
</section>
|
|
178
|
+
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
|
179
|
+
<a name="targetlatency" class="tsd-anchor"></a>
|
|
180
|
+
<h3>target<wbr>Latency</h3>
|
|
181
|
+
<div class="tsd-signature tsd-kind-icon">target<wbr>Latency<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
|
|
182
|
+
<aside class="tsd-sources">
|
|
183
|
+
<ul>
|
|
184
|
+
<li>Defined in MKPlayerConfiguration.ts:33</li>
|
|
185
|
+
</ul>
|
|
186
|
+
</aside>
|
|
187
|
+
<div class="tsd-comment tsd-typography">
|
|
188
|
+
<div class="lead">
|
|
189
|
+
<p>number of seconds the player attempts to stay behind the live point</p>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
</section>
|
|
193
|
+
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
|
194
|
+
<a name="ui" class="tsd-anchor"></a>
|
|
195
|
+
<h3>ui</h3>
|
|
196
|
+
<div class="tsd-signature tsd-kind-icon">ui<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
|
|
197
|
+
<aside class="tsd-sources">
|
|
198
|
+
<ul>
|
|
199
|
+
<li>Defined in MKPlayerConfiguration.ts:28</li>
|
|
200
|
+
</ul>
|
|
201
|
+
</aside>
|
|
202
|
+
<div class="tsd-comment tsd-typography">
|
|
203
|
+
<div class="lead">
|
|
204
|
+
<p>Boolean to enable / disable ui</p>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</section>
|
|
160
208
|
</section>
|
|
161
209
|
</div>
|
|
162
210
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
@@ -189,12 +237,21 @@
|
|
|
189
237
|
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
|
190
238
|
<a href="mkplayerconfiguration.html#debug" class="tsd-kind-icon">debug</a>
|
|
191
239
|
</li>
|
|
240
|
+
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
|
241
|
+
<a href="mkplayerconfiguration.html#key" class="tsd-kind-icon">key</a>
|
|
242
|
+
</li>
|
|
192
243
|
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
|
193
244
|
<a href="mkplayerconfiguration.html#muted" class="tsd-kind-icon">muted</a>
|
|
194
245
|
</li>
|
|
195
246
|
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
|
196
247
|
<a href="mkplayerconfiguration.html#smallscreen" class="tsd-kind-icon">small<wbr>Screen</a>
|
|
197
248
|
</li>
|
|
249
|
+
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
|
250
|
+
<a href="mkplayerconfiguration.html#targetlatency" class="tsd-kind-icon">target<wbr>Latency</a>
|
|
251
|
+
</li>
|
|
252
|
+
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
|
253
|
+
<a href="mkplayerconfiguration.html#ui" class="tsd-kind-icon">ui</a>
|
|
254
|
+
</li>
|
|
198
255
|
</ul>
|
|
199
256
|
</li>
|
|
200
257
|
</ul>
|
package/index.html
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang='en'>
|
|
3
3
|
<head>
|
|
4
|
-
<title>MKPlayer 1.0.
|
|
4
|
+
<title>MKPlayer 1.0.12</title>
|
|
5
5
|
<meta charset='UTF-8'/>
|
|
6
6
|
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
|
|
7
7
|
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
<input type='radio' name='options' id='option-hls-subtitle' autocomplete='off'>HLS Subtitle
|
|
99
99
|
</label>
|
|
100
100
|
<label class='btn btn-outline-secondary'>
|
|
101
|
-
<input type='radio' name='options' id='option-
|
|
101
|
+
<input type='radio' name='options' id='option-emsg-1' autocomplete='off'>EMSG Live
|
|
102
102
|
</label>
|
|
103
103
|
<label class='btn btn-outline-secondary'>
|
|
104
104
|
<input type='radio' name='options' id='option-mp4-2' autocomplete='off'>MP4 Source 2
|
|
@@ -151,19 +151,33 @@
|
|
|
151
151
|
<p id='playbackBitrate'>Video Playback Bitrate: unknown</p>
|
|
152
152
|
</div>
|
|
153
153
|
</div>
|
|
154
|
+
<div class='row'>
|
|
155
|
+
<div class='col-12'>
|
|
156
|
+
<p id='wallClockTime'>Wall Clock Time: unknown</p>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
<div class='row'>
|
|
160
|
+
<div class='col-12'>
|
|
161
|
+
<p id='segmentTime'>Segment Time: unknown</p>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
154
164
|
<div class='row'>
|
|
155
165
|
<div class='col-12'>
|
|
156
166
|
<p id='segmentPlaybackLabel'>Segment: unknown</p>
|
|
157
167
|
</div>
|
|
158
168
|
</div>
|
|
169
|
+
<div class='row'>
|
|
170
|
+
<div class='col-12'>
|
|
171
|
+
<p id='metadataLabel'>Metadata: unknown</p>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
159
174
|
</div>
|
|
160
175
|
<script type='text/javascript'>
|
|
161
|
-
let mkPlayer;
|
|
162
176
|
let vodButton = $('#option-vod').parent();
|
|
163
177
|
let dashVodButton = $('#option-dash-vod').parent();
|
|
164
178
|
let dashSubtitleButton = $('#option-dash-subtitle').parent();
|
|
165
179
|
let hlsSubtitleButton = $('#option-hls-subtitle').parent();
|
|
166
|
-
let
|
|
180
|
+
let emsgButton = $('#option-emsg-1').parent();
|
|
167
181
|
let mp4Button2 = $('#option-mp4-2').parent();
|
|
168
182
|
let mp4Button3 = $('#option-mp4-3').parent();
|
|
169
183
|
let liveButton = $('#option-live').parent();
|
|
@@ -189,6 +203,19 @@
|
|
|
189
203
|
});
|
|
190
204
|
}
|
|
191
205
|
|
|
206
|
+
function formatTimestamp(timestamp) {
|
|
207
|
+
var date = new Date(timestamp * 1000);
|
|
208
|
+
var hours = date.getHours();
|
|
209
|
+
var minutes = "0" + date.getMinutes();
|
|
210
|
+
var seconds = "0" + date.getSeconds();
|
|
211
|
+
var millis = "0" + date.getMilliseconds();
|
|
212
|
+
|
|
213
|
+
var formattedTime = date.toDateString() + ' ' + hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2) + ':' + millis.substr(-3);
|
|
214
|
+
|
|
215
|
+
return formattedTime;
|
|
216
|
+
|
|
217
|
+
}
|
|
218
|
+
|
|
192
219
|
vodButton.on('click', function() {
|
|
193
220
|
vodButton.button('toggle');
|
|
194
221
|
deselectCustomLoadButton();
|
|
@@ -224,10 +251,10 @@
|
|
|
224
251
|
load(errorSource);
|
|
225
252
|
});
|
|
226
253
|
|
|
227
|
-
|
|
228
|
-
|
|
254
|
+
emsgButton.on('click', function() {
|
|
255
|
+
emsgButton.button('toggle');
|
|
229
256
|
deselectCustomLoadButton();
|
|
230
|
-
load(
|
|
257
|
+
load(emsgSource);
|
|
231
258
|
});
|
|
232
259
|
|
|
233
260
|
mp4Button2.on('click', function() {
|
|
@@ -247,7 +274,7 @@
|
|
|
247
274
|
deselectCustomLoadButton();
|
|
248
275
|
|
|
249
276
|
mkPlayer.unload();
|
|
250
|
-
load(
|
|
277
|
+
load(liveId3Source);
|
|
251
278
|
});
|
|
252
279
|
|
|
253
280
|
customStreamButton.on('click', function() {
|
|
@@ -260,7 +287,7 @@
|
|
|
260
287
|
assetIdentifier: 'Custom Source',
|
|
261
288
|
};
|
|
262
289
|
|
|
263
|
-
if($('#subtitle-url').val() && $('#subtitle-language').val()) {
|
|
290
|
+
if ($('#subtitle-url').val() && $('#subtitle-language').val()) {
|
|
264
291
|
customSource.subtitleTracks = [{
|
|
265
292
|
url: $('#subtitle-url').val(),
|
|
266
293
|
language: $('#subtitle-language').val(),
|
|
@@ -279,9 +306,26 @@
|
|
|
279
306
|
});
|
|
280
307
|
|
|
281
308
|
let liveSource = {
|
|
282
|
-
primaryUrl: "https://
|
|
309
|
+
primaryUrl: "https://cdn-0573.aas.mediakind.com/cmaf/CES-Hero/index.m3u8",
|
|
283
310
|
cdnFailoverPercent: 10,
|
|
284
311
|
assetIdentifier: 'DASH Live',
|
|
312
|
+
subtitleTracks: [{
|
|
313
|
+
url: "https://cestestssl.akamaized.net/hls/live/2023638/cestest6/master_captionENG.m3u8",
|
|
314
|
+
language: '123',
|
|
315
|
+
type: 'm3u8'
|
|
316
|
+
}]
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
let liveId3Source = {
|
|
320
|
+
primaryUrl: "http://52.232.209.101/hls-ts/MKChannelOne/index.m3u8",
|
|
321
|
+
cdnFailoverPercent: 10,
|
|
322
|
+
assetIdentifier: 'ID3 Live',
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
let emsgSource = {
|
|
326
|
+
primaryUrl: "https://livesim.dashif.org/livesim/scte35_2/testpic_2s/Manifest.mpd",
|
|
327
|
+
cdnFailoverPercent: 0,
|
|
328
|
+
assetIdentifier: 'EMSG Live',
|
|
285
329
|
};
|
|
286
330
|
|
|
287
331
|
let dashSubtitleSource = {
|
|
@@ -291,7 +335,7 @@
|
|
|
291
335
|
language: 'aa',
|
|
292
336
|
}],
|
|
293
337
|
assetIdentifier: 'DASH Subtitle',
|
|
294
|
-
poster: 'https://bitmovin-a.akamaihd.net/content/sintel/poster.png'
|
|
338
|
+
poster: 'https://bitmovin-a.akamaihd.net/content/sintel/poster.png',
|
|
295
339
|
};
|
|
296
340
|
|
|
297
341
|
let dashVodSource = {
|
|
@@ -307,7 +351,7 @@
|
|
|
307
351
|
let hlsSubtitleSource = {
|
|
308
352
|
primaryUrl: 'https://mk-orionsedge.azureedge.net/test/hls/tos/index.m3u8',
|
|
309
353
|
cdnFailoverPercent: 0,
|
|
310
|
-
assetIdentifier: 'HLS Subtitle'
|
|
354
|
+
assetIdentifier: 'HLS Subtitle',
|
|
311
355
|
}
|
|
312
356
|
|
|
313
357
|
var vodSource = {
|
|
@@ -341,7 +385,7 @@
|
|
|
341
385
|
{
|
|
342
386
|
url: 'https://mediusprodstatic.studios.ms/video-28731/Caption_ar-EG.vtt?sv=2018-03-28&sr=c&sig=qFHd87nMFTZWXNkDIEcq4656fFH6Zb%2Fd40q4zaVSOJA%3D&se=2025-05-26T15%3A52%3A20Z&sp=r',
|
|
343
387
|
language: 'ms',
|
|
344
|
-
}
|
|
388
|
+
},
|
|
345
389
|
],
|
|
346
390
|
}
|
|
347
391
|
|
|
@@ -356,10 +400,11 @@
|
|
|
356
400
|
autoplay: true,
|
|
357
401
|
muted: true,
|
|
358
402
|
smallScreen: false,
|
|
403
|
+
key: '84dc4716-55f9-43fa-ae8e-6fa334c5189b'
|
|
359
404
|
};
|
|
360
405
|
|
|
361
406
|
let playerContainer = document.getElementById('testPlayer');
|
|
362
|
-
mkPlayer = new mkplayer.MKPlayer(playerContainer, mkPlayerConfiguration);
|
|
407
|
+
let mkPlayer = new mkplayer.MKPlayer(playerContainer, mkPlayerConfiguration);
|
|
363
408
|
|
|
364
409
|
mkPlayer.on('error', function(event) {
|
|
365
410
|
console.error('[MKPlayer] error: %d - %s', event.code, event.name);
|
|
@@ -373,14 +418,25 @@
|
|
|
373
418
|
console.info('[MKPlayer] ready ' + event.timestamp);
|
|
374
419
|
})
|
|
375
420
|
|
|
421
|
+
const getAudioBufferLevel = function() {
|
|
422
|
+
return mkPlayer.getBufferLevels().audio
|
|
423
|
+
};
|
|
424
|
+
const getVideoBufferLevel = function() {
|
|
425
|
+
return mkPlayer.getBufferLevels().video
|
|
426
|
+
};
|
|
376
427
|
mkPlayer.on('timechanged', function(event) {
|
|
377
|
-
|
|
428
|
+
let videoBufferLevel = Math.round(getVideoBufferLevel() * 100) / 100;
|
|
378
429
|
$('#videoBuffer').css('width', videoBufferLevel + '%').attr('aria-valuenow', videoBufferLevel);
|
|
379
430
|
$('#videoBuffer').text(videoBufferLevel)
|
|
380
431
|
|
|
381
|
-
|
|
432
|
+
let audioBufferLevel = Math.round(getAudioBufferLevel() * 100) / 100;
|
|
382
433
|
$('#audioBuffer').css('width', audioBufferLevel + '%').attr('aria-valuenow', audioBufferLevel);
|
|
383
434
|
$('#audioBuffer').text(audioBufferLevel)
|
|
435
|
+
|
|
436
|
+
$('#segmentTime').text('Segment Time: ' + formatTimestamp(event.time))
|
|
437
|
+
|
|
438
|
+
$('#wallClockTime').text('Wall Clock Time: ' + formatTimestamp(Date.now()/1000))
|
|
439
|
+
|
|
384
440
|
})
|
|
385
441
|
|
|
386
442
|
mkPlayer.on('playing', function(event) {
|
|
@@ -389,10 +445,11 @@
|
|
|
389
445
|
$('#startupTime').text('Video Startup Time: ' + startupTime.getSeconds() + "." + startupTime.getMilliseconds());
|
|
390
446
|
startupTimeCalculated = true
|
|
391
447
|
}
|
|
448
|
+
console.info('[MKPlayer] playing: ' + JSON.stringify(event));
|
|
392
449
|
})
|
|
393
450
|
|
|
394
451
|
mkPlayer.on('paused', function(event) {
|
|
395
|
-
console.info('[MKPlayer] paused' + JSON.stringify(event));
|
|
452
|
+
console.info('[MKPlayer] paused: ' + JSON.stringify(event));
|
|
396
453
|
})
|
|
397
454
|
|
|
398
455
|
mkPlayer.on('playbackfinished', (event) => {
|
|
@@ -403,8 +460,8 @@
|
|
|
403
460
|
if (event.mimeType === 'video/mp4') {
|
|
404
461
|
let segmentUrl = event.url
|
|
405
462
|
let fileNameIndex = segmentUrl.lastIndexOf("/") + 1;
|
|
406
|
-
|
|
407
|
-
$('#segmentPlaybackLabel').text('[MKPlayer] Segment: url=' + filename + '
|
|
463
|
+
const filename = segmentUrl.substr(fileNameIndex);
|
|
464
|
+
$('#segmentPlaybackLabel').text('[MKPlayer] Segment: url=' + filename + ' time=' + event.playbackTime)
|
|
408
465
|
previousSegmentPlaybackTime = event.playbackTime;
|
|
409
466
|
}
|
|
410
467
|
})
|
|
@@ -414,15 +471,15 @@
|
|
|
414
471
|
$('#playbackBitrate').text('Video Playback Quality: ' + currentPlayingBitrate)
|
|
415
472
|
});
|
|
416
473
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
474
|
+
mkPlayer.on('metadata', function(event) {
|
|
475
|
+
$('#metadataLabel').text('Metadata: ' + JSON.stringify(event));
|
|
476
|
+
});
|
|
420
477
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
478
|
+
mkPlayer.on('metadataparsed', function(event) {
|
|
479
|
+
console.info('[MKPlayer] metadata parsed' + JSON.stringify(event));
|
|
480
|
+
});
|
|
424
481
|
|
|
425
|
-
load(
|
|
482
|
+
load(liveId3Source)
|
|
426
483
|
|
|
427
484
|
</script>
|
|
428
485
|
</body>
|