@flashphoner/websdk 2.0.244 → 2.0.245

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.
@@ -1,4 +1,4 @@
1
- Web SDK - 2.0.244
1
+ Web SDK - 2.0.245
2
2
 
3
3
  [Download builds](https://docs.flashphoner.com/display/WEBSDK2EN/Web+SDK+release+notes)
4
4
 
@@ -1,11 +1,18 @@
1
1
  const Browser = Flashphoner.Browser;
2
2
  const STATS_INTERVAL = 1000;
3
+ const QUALITY_COLORS = {
4
+ NONE: "",
5
+ AVAILABLE: "black",
6
+ SELECTED: "blue"
7
+ };
8
+ const QUALITY_AUTO = "Auto";
3
9
  let remoteVideo = null;
4
10
  let hlsPlayer = null;
5
11
  let playSrc = getUrlParam("src");
6
12
  let autoplay = eval(getUrlParam("autoplay")) || false;
7
13
  let llHlsEnabled = eval(getUrlParam("llhls")) || false;
8
14
  let playbackStats = null;
15
+ let qualityLevels = [];
9
16
 
10
17
  const loadPlayerPage = function() {
11
18
  loadPage("../hls-player/player-page.html", "playerPage", initPage );
@@ -72,10 +79,12 @@ const playBtnClick = function() {
72
79
  hlsPlayer.on(Hls.Events.MANIFEST_PARSED, function() {
73
80
  console.log("Play with HLS.js");
74
81
  remoteVideo.play();
82
+ initQualityLevels(hlsPlayer);
75
83
  });
76
84
  remoteVideo.onplaying = () => {
77
85
  console.log("playing event fired");
78
86
  displayPermalink(videoSrc);
87
+ displayQualitySwitch();
79
88
  }
80
89
  hlsPlayer.loadSource(videoSrc);
81
90
  hlsPlayer.attachMedia(remoteVideo);
@@ -91,7 +100,7 @@ const getHlsConfig = function(llHlsEnabled) {
91
100
  backBufferLength: 90,
92
101
  manifestLoadingTimeOut: 15000
93
102
  };
94
- console.log("Low Latency HLS: "+llHlsEnabled)
103
+ console.log("Low Latency HLS: " + llHlsEnabled)
95
104
  if(llHlsEnabled) {
96
105
  // Here we configure HLS.JS for lower latency
97
106
  config = {
@@ -146,6 +155,8 @@ function onStopped() {
146
155
  setText("applyBtn", "Play");
147
156
  setHandler("applyBtn", "click", playBtnClick, stopBtnClick);
148
157
  stopPlaybackStats();
158
+ hideItem("quality");
159
+ disposeQualityLevels();
149
160
  }
150
161
  }
151
162
 
@@ -248,6 +259,12 @@ const displayPermalink = function(src) {
248
259
  }
249
260
  }
250
261
 
262
+ const displayQualitySwitch = function() {
263
+ if (!autoplay && qualityLevels.length) {
264
+ showItem("quality")
265
+ }
266
+ }
267
+
251
268
  const hideAllToAutoplay = function() {
252
269
  hideItem("header");
253
270
  hideItem("notifyFlash");
@@ -342,4 +359,65 @@ const PlaybackStats = function(interval) {
342
359
  }
343
360
  };
344
361
  return playbackStats;
362
+ }
363
+
364
+ const initQualityLevels = function(player) {
365
+ if (player) {
366
+ let qualityDiv = document.getElementById("qualityBtns");
367
+ let qualityLevel;
368
+ for (let i = 0; i < player.levels.length; i++) {
369
+ qualityLevel = QualityLevel(player, player.levels[i].height, i, qualityDiv);
370
+ qualityLevels.push(qualityLevel);
371
+ }
372
+ if (qualityLevels.length) {
373
+ qualityLevel = QualityLevel(player, QUALITY_AUTO, -1, qualityDiv);
374
+ qualityLevels.push(qualityLevel);
375
+ }
376
+ }
377
+ }
378
+
379
+ const disposeQualityLevels = function() {
380
+ qualityLevels.forEach(level => {
381
+ if (level.button) {
382
+ level.button.remove();
383
+ }
384
+ });
385
+ qualityLevels = [];
386
+ }
387
+
388
+ const qualityBtnClick = function(button, player, index) {
389
+ if (player) {
390
+ player.currentLevel = index;
391
+ }
392
+ button.style.color = QUALITY_COLORS.SELECTED;
393
+ qualityLevels.forEach(item => {
394
+ if (item.button.id !== button.id) {
395
+ item.button.style.color = QUALITY_COLORS.AVAILABLE
396
+ }
397
+ });
398
+ }
399
+
400
+ const QualityLevel = function(object, levelId, index, btnParent) {
401
+ const btnId = "qualityBtn";
402
+ let button = document.createElement("button");
403
+ if (levelId === QUALITY_AUTO && index === -1) {
404
+ button.id = btnId + QUALITY_AUTO;
405
+ button.innerHTML = QUALITY_AUTO
406
+ } else {
407
+ button.id = btnId + index;
408
+ button.innerHTML = levelId;
409
+ }
410
+ button.type = "button";
411
+ button.className = "btn btn-default";
412
+ button.style.color = QUALITY_COLORS.AVAILABLE;
413
+ button.onclick = (event) => {
414
+ qualityBtnClick(button, object, index);
415
+ };
416
+ btnParent.appendChild(button);
417
+ const qualityLevel = {
418
+ level: levelId,
419
+ index: index,
420
+ button: button
421
+ };
422
+ return qualityLevel;
345
423
  }
@@ -7,12 +7,19 @@ const LIVE_THRESHOLD = 5;
7
7
  const LIVE_TOLERANCE = 5;
8
8
  const LIVE_UI_INTERVAL = 1000;
9
9
  const STATS_INTERVAL = 1000;
10
+ const QUALITY_COLORS = {
11
+ NONE: "",
12
+ AVAILABLE: "black",
13
+ SELECTED: "blue"
14
+ };
15
+ const QUALITY_AUTO = "Auto";
10
16
  let player = null;
11
17
  let liveUITimer = null;
12
18
  let videojsVersion = getUrlParam("version");
13
19
  let playSrc = getUrlParam("src");
14
20
  let autoplay = eval(getUrlParam("autoplay")) || false;
15
21
  let playbackStats = null;
22
+ let qualityLevels = [];
16
23
 
17
24
  const loadPlayerPage = function() {
18
25
  if (videojsVersion) {
@@ -44,27 +51,50 @@ const loadPlayerPage = function() {
44
51
  }
45
52
  }
46
53
 
47
- const onVideojsBtnClick = function () {
54
+ const onVideojsBtnClick = function() {
48
55
  loadVideoJS(getValue("videojsInput"));
49
56
  }
50
57
 
51
- const loadVideoJS = function (version) {
58
+ const loadVideoJS = function(version) {
52
59
  if (version) {
53
60
  videojsVersion = version;
54
61
  let playerPage = document.getElementById("playerPage");
55
62
  loadFile(version + "/video.js", "text/javascript").then( data => {
56
63
  console.log("HLS library loaded successfully", data);
57
- loadFile(version + "/video-js.css", "stylesheet").then ( data => {
58
- console.log("HLS library stylesheet loaded successfully", data);
64
+ loadStyles(version, playerPage);
65
+ }).catch( err => {
66
+ setText("videojsError", "Can't load VideoJS library");
67
+ console.error(err);
68
+ });
69
+ }
70
+ }
71
+
72
+ const loadStyles = function(version, playerPage) {
73
+ if (version) {
74
+ loadFile(version + "/video-js.css", "stylesheet").then ( data => {
75
+ console.log("HLS library stylesheet loaded successfully", data);
76
+ if (version === VIDEOJS_VERSION_TYPE.VIDEOJS7) {
77
+ loadQualityPlugin(version, playerPage);
78
+ } else {
59
79
  hideItem("videojsInputForm");
60
80
  loadPage("player-page.html", "playerPage", initPage);
61
- }).catch( err => {
62
- playerPage.innerHTML = "Can't load VideoJS library stylesheet";
63
- playerPage.setAttribute("class", "text-danger");
64
- console.error(err);
65
- })
81
+ }
66
82
  }).catch( err => {
67
- setText("videojsError", "Can't load VideoJS library");
83
+ playerPage.innerHTML = "Can't load VideoJS library stylesheet";
84
+ playerPage.setAttribute("class", "text-danger");
85
+ console.error(err);
86
+ });
87
+ }
88
+ }
89
+
90
+ const loadQualityPlugin = function(version, playerPage) {
91
+ if (version) {
92
+ loadFile(version + "/videojs-contrib-quality-levels.js", "text/javascript").then( data => {
93
+ console.log("HLS quality levels plugin loaded successfully", data);
94
+ hideItem("videojsInputForm");
95
+ loadPage("player-page.html", "playerPage", initPage);
96
+ }).catch( err => {
97
+ setText("videojsError", "Can't load VideoJS quality levels plugin");
68
98
  console.error(err);
69
99
  });
70
100
  }
@@ -183,6 +213,8 @@ const playBtnClick = function() {
183
213
  stopLiveUITimer();
184
214
  }
185
215
  }
216
+ initQualityLevels(player);
217
+ displayQualitySwitch();
186
218
  });
187
219
  player.src({
188
220
  src: videoSrc,
@@ -253,6 +285,7 @@ const onStarted = function() {
253
285
  setText("applyBtn", "Stop");
254
286
  setHandler("applyBtn", "click", stopBtnClick, playBtnClick);
255
287
  startPlaybackStats();
288
+ hideItem("quality");
256
289
  }
257
290
  }
258
291
 
@@ -265,6 +298,8 @@ const onStopped = function() {
265
298
  setText("applyBtn", "Play");
266
299
  setHandler("applyBtn", "click", playBtnClick, stopBtnClick);
267
300
  stopPlaybackStats();
301
+ hideItem("quality");
302
+ disposeQualityLevels();
268
303
  }
269
304
  if(!document.getElementById('remoteVideo')) {
270
305
  createRemoteVideo(document.getElementById('videoContainer'));
@@ -340,7 +375,12 @@ const initVideoJsPlayer = function(video, muted) {
340
375
  liveTolerance: LIVE_TOLERANCE
341
376
  },
342
377
  fill: true,
343
- muted: muted
378
+ muted: muted,
379
+ html5: {
380
+ vhs: {
381
+ limitRenditionByPlayerDimensions: false
382
+ }
383
+ }
344
384
  });
345
385
  console.log("Using VideoJs " + videojs.VERSION);
346
386
  if (Browser.isSafariWebRTC() && Browser.isiOS()) {
@@ -427,6 +467,12 @@ const displayPermalink = function(src) {
427
467
  }
428
468
  }
429
469
 
470
+ const displayQualitySwitch = function() {
471
+ if (!autoplay && qualityLevels.length) {
472
+ showItem("quality")
473
+ }
474
+ }
475
+
430
476
  const hideAllToAutoplay = function() {
431
477
  hideItem("header");
432
478
  hideItem("notifyFlash");
@@ -520,4 +566,81 @@ const PlaybackStats = function(interval) {
520
566
  }
521
567
  };
522
568
  return playbackStats;
523
- }
569
+ }
570
+
571
+ const initQualityLevels = function(player) {
572
+ if (player && !qualityLevels.length) {
573
+ let playerQualityLevels = player.qualityLevels();
574
+ if (playerQualityLevels) {
575
+ let qualityDiv = document.getElementById("qualityBtns");
576
+ let qualityLevel;
577
+ for (let i = 0; i < playerQualityLevels.length; i++) {
578
+ qualityLevel = QualityLevel(playerQualityLevels, playerQualityLevels[i].height, i, qualityDiv);
579
+ qualityLevels.push(qualityLevel);
580
+ }
581
+ if (qualityLevels.length) {
582
+ qualityLevel = QualityLevel(playerQualityLevels, QUALITY_AUTO, -1, qualityDiv);
583
+ qualityLevels.push(qualityLevel);
584
+ }
585
+ }
586
+ }
587
+ }
588
+
589
+ const disposeQualityLevels = function() {
590
+ qualityLevels.forEach(level => {
591
+ if (level.button) {
592
+ level.button.remove();
593
+ }
594
+ });
595
+ qualityLevels = [];
596
+ }
597
+
598
+ const qualityBtnClick = function(button, playerQualityLevels, index) {
599
+ if (playerQualityLevels && playerQualityLevels.length) {
600
+ let currentIndex = playerQualityLevels.selectedIndex_;
601
+ for (let i = 0; i < playerQualityLevels.length; i++) {
602
+ let qualityLevel = playerQualityLevels[i];
603
+ if (index === -1 || i === index) {
604
+ qualityLevel.enabled = true;
605
+ } else if (i === index) {
606
+ qualityLevel.enabled = true;
607
+ currentIndex = index;
608
+ } else {
609
+ qualityLevel.enabled = false;
610
+ }
611
+ }
612
+ playerQualityLevels.selectedIndex_ = currentIndex;
613
+ playerQualityLevels.trigger({ type: 'change', selectedIndex: currentIndex });
614
+ }
615
+ button.style.color = QUALITY_COLORS.SELECTED;
616
+ qualityLevels.forEach(item => {
617
+ if (item.button.id !== button.id) {
618
+ item.button.style.color = QUALITY_COLORS.AVAILABLE
619
+ }
620
+ });
621
+ }
622
+
623
+ const QualityLevel = function(object, levelId, index, btnParent) {
624
+ const btnId = "qualityBtn";
625
+ let button = document.createElement("button");
626
+ if (levelId === QUALITY_AUTO && index === -1) {
627
+ button.id = btnId + QUALITY_AUTO;
628
+ button.innerHTML = QUALITY_AUTO;
629
+ } else {
630
+ button.id = btnId + index;
631
+ button.innerHTML = levelId;
632
+ }
633
+ button.type = "button";
634
+ button.className = "btn btn-default";
635
+ button.style.color = QUALITY_COLORS.AVAILABLE;
636
+ button.onclick = (event) => {
637
+ qualityBtnClick(button, object, index);
638
+ };
639
+ btnParent.appendChild(button);
640
+ const qualityLevel = {
641
+ level: levelId,
642
+ index: index,
643
+ button: button
644
+ };
645
+ return qualityLevel;
646
+ }
@@ -55,22 +55,40 @@
55
55
  </div>
56
56
  </div>
57
57
 
58
- <div class="row" style="margin-top:10px">
58
+ <div class="row" style="margin-top: 10px">
59
+ <div class="col-sm-4 text-left" id="llHlsMode" style="display: none;">
60
+ <input id="llHlsEnabled" class="form-check-input" type="checkbox" value="">
61
+ <label class="form-check-label" for="llHlsEnabled">Low latency HLS</label>
62
+ </div>
63
+ </div>
64
+ <div class="row" style="margin-top: 5px">
59
65
  <div class="col-sm-12 text-center">
60
66
  <a id="permalink" href="#">Permalink</a>
61
67
  </div>
62
68
  </div>
69
+ <div class="row" style="margin-top: 10px">
70
+ <div class="col-sm-12 text-center">
71
+ <button id="applyBtn" type="button" class="btn btn-default">Play</button>
72
+ </div>
73
+ </div>
63
74
 
64
- <div class="row" style="margin-top: 20px">
65
- <div class="col-sm-4 text-left">
66
- <div id="llHlsMode" style="display: none;">
67
- <input id="llHlsEnabled" class="form-check-input" type="checkbox" value="">
68
- <label class="form-check-label" for="llHlsEnabled">Low latency HLS</label>
75
+ <div class="row" style="margin-top: 10px">
76
+ <div class="col-sm-12" id="quality" style="display: none;">
77
+ <div class="col-sm-4 text-right">
78
+ <label class="form-check-label" for="qualityBtns">Quality</label>
79
+ </div>
80
+ <div class="col-sm-8 text-center">
81
+ <div class="input-group-btn" id="qualityBtns">
82
+ </div>
69
83
  </div>
70
84
  </div>
71
- <div class="col-sm-5">
72
- <div id="backward" style="display: none;">
73
- <label class="form-check-label text-right" for="backBtnMax">&lt;&lt; seconds</label>
85
+ </div>
86
+ <div class="row" style="margin-top: 10px">
87
+ <div class="col-sm-12" id="backward" style="display: none;">
88
+ <div class="col-sm-4 text-right">
89
+ <label class="form-check-label" for="backBtnMax">Rewind back</label>
90
+ </div>
91
+ <div class="col-sm-8 text-center">
74
92
  <div class="input-group-btn">
75
93
  <button id="backBtnMax" type="button" class="btn btn-default">Max</button>
76
94
  <button id="backBtn30" type="button" class="btn btn-default">30</button>
@@ -79,9 +97,6 @@
79
97
  </div>
80
98
  </div>
81
99
  </div>
82
- <div class="col-sm-3 text-right">
83
- <button id="applyBtn" type="button" class="btn btn-default">Play</button>
84
- </div>
85
100
  </div>
86
101
  </fieldset>
87
102
  </div>
@@ -0,0 +1,308 @@
1
+ /*! @name videojs-contrib-quality-levels @version 3.0.0 @license Apache-2.0 */
2
+ (function (global, factory) {
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('video.js')) :
4
+ typeof define === 'function' && define.amd ? define(['video.js'], factory) :
5
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.videojsContribQualityLevels = factory(global.videojs));
6
+ }(this, (function (videojs) { 'use strict';
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var videojs__default = /*#__PURE__*/_interopDefaultLegacy(videojs);
11
+
12
+ /**
13
+ * A single QualityLevel.
14
+ *
15
+ * interface QualityLevel {
16
+ * readonly attribute DOMString id;
17
+ * attribute DOMString label;
18
+ * readonly attribute long width;
19
+ * readonly attribute long height;
20
+ * readonly attribute long bitrate;
21
+ * attribute boolean enabled;
22
+ * };
23
+ *
24
+ * @class QualityLevel
25
+ */
26
+ class QualityLevel {
27
+ /**
28
+ * Creates a QualityLevel
29
+ *
30
+ * @param {Representation|Object} representation The representation of the quality level
31
+ * @param {string} representation.id Unique id of the QualityLevel
32
+ * @param {number=} representation.width Resolution width of the QualityLevel
33
+ * @param {number=} representation.height Resolution height of the QualityLevel
34
+ * @param {number} representation.bandwidth Bitrate of the QualityLevel
35
+ * @param {number=} representation.frameRate Frame-rate of the QualityLevel
36
+ * @param {Function} representation.enabled Callback to enable/disable QualityLevel
37
+ */
38
+ constructor(representation) {
39
+ let level = this; // eslint-disable-line
40
+
41
+ level.id = representation.id;
42
+ level.label = level.id;
43
+ level.width = representation.width;
44
+ level.height = representation.height;
45
+ level.bitrate = representation.bandwidth;
46
+ level.frameRate = representation.frameRate;
47
+ level.enabled_ = representation.enabled;
48
+ Object.defineProperty(level, 'enabled', {
49
+ /**
50
+ * Get whether the QualityLevel is enabled.
51
+ *
52
+ * @return {boolean} True if the QualityLevel is enabled.
53
+ */
54
+ get() {
55
+ return level.enabled_();
56
+ },
57
+
58
+ /**
59
+ * Enable or disable the QualityLevel.
60
+ *
61
+ * @param {boolean} enable true to enable QualityLevel, false to disable.
62
+ */
63
+ set(enable) {
64
+ level.enabled_(enable);
65
+ }
66
+
67
+ });
68
+ return level;
69
+ }
70
+
71
+ }
72
+
73
+ /**
74
+ * A list of QualityLevels.
75
+ *
76
+ * interface QualityLevelList : EventTarget {
77
+ * getter QualityLevel (unsigned long index);
78
+ * readonly attribute unsigned long length;
79
+ * readonly attribute long selectedIndex;
80
+ *
81
+ * void addQualityLevel(QualityLevel qualityLevel)
82
+ * void removeQualityLevel(QualityLevel remove)
83
+ * QualityLevel? getQualityLevelById(DOMString id);
84
+ *
85
+ * attribute EventHandler onchange;
86
+ * attribute EventHandler onaddqualitylevel;
87
+ * attribute EventHandler onremovequalitylevel;
88
+ * };
89
+ *
90
+ * @extends videojs.EventTarget
91
+ * @class QualityLevelList
92
+ */
93
+
94
+ class QualityLevelList extends videojs__default['default'].EventTarget {
95
+ constructor() {
96
+ super();
97
+ let list = this; // eslint-disable-line
98
+
99
+ list.levels_ = [];
100
+ list.selectedIndex_ = -1;
101
+ /**
102
+ * Get the index of the currently selected QualityLevel.
103
+ *
104
+ * @returns {number} The index of the selected QualityLevel. -1 if none selected.
105
+ * @readonly
106
+ */
107
+
108
+ Object.defineProperty(list, 'selectedIndex', {
109
+ get() {
110
+ return list.selectedIndex_;
111
+ }
112
+
113
+ });
114
+ /**
115
+ * Get the length of the list of QualityLevels.
116
+ *
117
+ * @returns {number} The length of the list.
118
+ * @readonly
119
+ */
120
+
121
+ Object.defineProperty(list, 'length', {
122
+ get() {
123
+ return list.levels_.length;
124
+ }
125
+
126
+ });
127
+ return list;
128
+ }
129
+ /**
130
+ * Adds a quality level to the list.
131
+ *
132
+ * @param {Representation|Object} representation The representation of the quality level
133
+ * @param {string} representation.id Unique id of the QualityLevel
134
+ * @param {number=} representation.width Resolution width of the QualityLevel
135
+ * @param {number=} representation.height Resolution height of the QualityLevel
136
+ * @param {number} representation.bandwidth Bitrate of the QualityLevel
137
+ * @param {number=} representation.frameRate Frame-rate of the QualityLevel
138
+ * @param {Function} representation.enabled Callback to enable/disable QualityLevel
139
+ * @return {QualityLevel} the QualityLevel added to the list
140
+ * @method addQualityLevel
141
+ */
142
+
143
+
144
+ addQualityLevel(representation) {
145
+ let qualityLevel = this.getQualityLevelById(representation.id); // Do not add duplicate quality levels
146
+
147
+ if (qualityLevel) {
148
+ return qualityLevel;
149
+ }
150
+
151
+ const index = this.levels_.length;
152
+ qualityLevel = new QualityLevel(representation);
153
+
154
+ if (!('' + index in this)) {
155
+ Object.defineProperty(this, index, {
156
+ get() {
157
+ return this.levels_[index];
158
+ }
159
+
160
+ });
161
+ }
162
+
163
+ this.levels_.push(qualityLevel);
164
+ this.trigger({
165
+ qualityLevel,
166
+ type: 'addqualitylevel'
167
+ });
168
+ return qualityLevel;
169
+ }
170
+ /**
171
+ * Removes a quality level from the list.
172
+ *
173
+ * @param {QualityLevel} remove QualityLevel to remove to the list.
174
+ * @return {QualityLevel|null} the QualityLevel removed or null if nothing removed
175
+ * @method removeQualityLevel
176
+ */
177
+
178
+
179
+ removeQualityLevel(qualityLevel) {
180
+ let removed = null;
181
+
182
+ for (let i = 0, l = this.length; i < l; i++) {
183
+ if (this[i] === qualityLevel) {
184
+ removed = this.levels_.splice(i, 1)[0];
185
+
186
+ if (this.selectedIndex_ === i) {
187
+ this.selectedIndex_ = -1;
188
+ } else if (this.selectedIndex_ > i) {
189
+ this.selectedIndex_--;
190
+ }
191
+
192
+ break;
193
+ }
194
+ }
195
+
196
+ if (removed) {
197
+ this.trigger({
198
+ qualityLevel,
199
+ type: 'removequalitylevel'
200
+ });
201
+ }
202
+
203
+ return removed;
204
+ }
205
+ /**
206
+ * Searches for a QualityLevel with the given id.
207
+ *
208
+ * @param {string} id The id of the QualityLevel to find.
209
+ * @return {QualityLevel|null} The QualityLevel with id, or null if not found.
210
+ * @method getQualityLevelById
211
+ */
212
+
213
+
214
+ getQualityLevelById(id) {
215
+ for (let i = 0, l = this.length; i < l; i++) {
216
+ const level = this[i];
217
+
218
+ if (level.id === id) {
219
+ return level;
220
+ }
221
+ }
222
+
223
+ return null;
224
+ }
225
+ /**
226
+ * Resets the list of QualityLevels to empty
227
+ *
228
+ * @method dispose
229
+ */
230
+
231
+
232
+ dispose() {
233
+ this.selectedIndex_ = -1;
234
+ this.levels_.length = 0;
235
+ }
236
+
237
+ }
238
+ /**
239
+ * change - The selected QualityLevel has changed.
240
+ * addqualitylevel - A QualityLevel has been added to the QualityLevelList.
241
+ * removequalitylevel - A QualityLevel has been removed from the QualityLevelList.
242
+ */
243
+
244
+
245
+ QualityLevelList.prototype.allowedEvents_ = {
246
+ change: 'change',
247
+ addqualitylevel: 'addqualitylevel',
248
+ removequalitylevel: 'removequalitylevel'
249
+ }; // emulate attribute EventHandler support to allow for feature detection
250
+
251
+ for (const event in QualityLevelList.prototype.allowedEvents_) {
252
+ QualityLevelList.prototype['on' + event] = null;
253
+ }
254
+
255
+ var version = "3.0.0";
256
+
257
+ const registerPlugin = videojs__default['default'].registerPlugin || videojs__default['default'].plugin;
258
+ /**
259
+ * Initialization function for the qualityLevels plugin. Sets up the QualityLevelList and
260
+ * event handlers.
261
+ *
262
+ * @param {Player} player Player object.
263
+ * @param {Object} options Plugin options object.
264
+ * @function initPlugin
265
+ */
266
+
267
+ const initPlugin = function (player, options) {
268
+ const originalPluginFn = player.qualityLevels;
269
+ const qualityLevelList = new QualityLevelList();
270
+
271
+ const disposeHandler = function () {
272
+ qualityLevelList.dispose();
273
+ player.qualityLevels = originalPluginFn;
274
+ player.off('dispose', disposeHandler);
275
+ };
276
+
277
+ player.on('dispose', disposeHandler);
278
+
279
+ player.qualityLevels = () => qualityLevelList;
280
+
281
+ player.qualityLevels.VERSION = version;
282
+ return qualityLevelList;
283
+ };
284
+ /**
285
+ * A video.js plugin.
286
+ *
287
+ * In the plugin function, the value of `this` is a video.js `Player`
288
+ * instance. You cannot rely on the player being in a "ready" state here,
289
+ * depending on how the plugin is invoked. This may or may not be important
290
+ * to you; if not, remove the wait for "ready"!
291
+ *
292
+ * @param {Object} options Plugin options object
293
+ * @function qualityLevels
294
+ */
295
+
296
+
297
+ const qualityLevels = function (options) {
298
+ return initPlugin(this, videojs__default['default'].mergeOptions({}, options));
299
+ }; // Register the plugin with video.js.
300
+
301
+
302
+ registerPlugin('qualityLevels', qualityLevels); // Include the version number.
303
+
304
+ qualityLevels.VERSION = version;
305
+
306
+ return qualityLevels;
307
+
308
+ })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashphoner/websdk",
3
- "version": "2.0.244",
3
+ "version": "2.0.245",
4
4
  "description": "Official Flashphoner WebCallServer WebSDK package",
5
5
  "main": "./src/flashphoner-core.js",
6
6
  "types": "./src/flashphoner-core.d.ts",