@antmedia/web_player 2.11.1 → 2.11.2
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/dist/browser/web_player.js +4 -6
- package/dist/es/{plugin-ca799d0d.js → plugin-50e1316e.js} +134 -144
- package/dist/es/{video.es-0951ae41.js → video.es-be70c095.js} +36 -41
- package/dist/es/{videojs-webrtc-plugin-327afa5e.js → videojs-webrtc-plugin-7054aa21.js} +1 -1
- package/dist/es/videojs-webrtc-plugin-f56e1f9e.js +3 -0
- package/dist/es/{video.es-22056625.js → videojs-webrtc-plugin.es-2a0dfc29.js} +14968 -5052
- package/dist/es/videojs-webrtc-plugin.es-333788d9.js +7673 -0
- package/dist/es/{videojs-webrtc-plugin.es-f41400f7.js → videojs-webrtc-plugin.es-777bf41a.js} +1747 -1697
- package/dist/es/{videojs-webrtc-plugin.es-bd0b1a6d.js → videojs-webrtc-plugin.es-9544f6e0.js} +1563 -1672
- package/dist/es/web_player.js +7 -9
- package/dist/index.d.ts +17 -1
- package/dist/{plugin-84ab2cdd.js → plugin-bec9dc4a.js} +136 -146
- package/dist/{video.es-474303e7.js → video.es-df9af03d.js} +36 -43
- package/dist/{videojs-webrtc-plugin-bdf9fa8b.js → videojs-webrtc-plugin-3becde8c.js} +1 -1
- package/dist/videojs-webrtc-plugin-77a9860b.js +5 -0
- package/dist/{videojs-webrtc-plugin.es-72234e77.js → videojs-webrtc-plugin.es-0787d11e.js} +1575 -1684
- package/dist/{video.es-72122d04.js → videojs-webrtc-plugin.es-493b195e.js} +14964 -5052
- package/dist/videojs-webrtc-plugin.es-8f4ea4e4.js +7675 -0
- package/dist/{videojs-webrtc-plugin.es-ac81d249.js → videojs-webrtc-plugin.es-ee6d0333.js} +1757 -1707
- package/dist/web_player.js +7 -9
- package/package.json +3 -5
- package/rollup.config.module.cjs +6 -2
- package/src/web_player.js +4 -6
- package/test/embedded-player.test.js +1 -1
- package/tsconfig.json +0 -1
- package/dist/aframe-master-42bb78a9.js +0 -7139
- package/dist/dash.all.min-84806d51.js +0 -36
- package/dist/es/aframe-master-a6146619.js +0 -7137
- package/dist/es/dash.all.min-4a2772b6.js +0 -34
- package/dist/es/inheritsLoose-91dc2acc.js +0 -15
- package/dist/es/video-js.min-8b4dfe88.js +0 -3
- package/dist/es/videojs-contrib-quality-levels.es-1ea32822.js +0 -276
- package/dist/es/videojs-contrib-quality-levels.es-5f5b5f23.js +0 -287
- package/dist/es/videojs-hls-quality-selector.es-3c54e1cd.js +0 -391
- package/dist/es/videojs-webrtc-plugin-b9e4da27.js +0 -3
- package/dist/inheritsLoose-281376c7.js +0 -17
- package/dist/video-js.min-7e4ae47a.js +0 -5
- package/dist/videojs-contrib-quality-levels.es-6c3be3eb.js +0 -278
- package/dist/videojs-contrib-quality-levels.es-ef3cec9e.js +0 -289
- package/dist/videojs-hls-quality-selector.es-562309df.js +0 -393
- package/dist/videojs-webrtc-plugin-d30c3e7a.js +0 -5
package/dist/es/web_player.js
CHANGED
|
@@ -704,12 +704,12 @@ class WebPlayer {
|
|
|
704
704
|
}
|
|
705
705
|
loadWebRTCComponents() {
|
|
706
706
|
if (this.playOrder.includes("webrtc")) {
|
|
707
|
-
return import('./videojs-webrtc-plugin-
|
|
707
|
+
return import('./videojs-webrtc-plugin-f56e1f9e.js').then(css => {
|
|
708
708
|
Logger_1.info("videojs-webrtc-plugin.css is loaded");
|
|
709
709
|
var styleElement = this.dom.createElement('style');
|
|
710
710
|
styleElement.textContent = css.default.toString(); // Assuming css module exports a string
|
|
711
711
|
this.dom.head.appendChild(styleElement);
|
|
712
|
-
return import('./videojs-webrtc-plugin.es-
|
|
712
|
+
return import('./videojs-webrtc-plugin.es-777bf41a.js').then(videojsWebrtcPluginLocal => {
|
|
713
713
|
Logger_1.info("videojs-webrtc-plugin is loaded");
|
|
714
714
|
});
|
|
715
715
|
});
|
|
@@ -730,14 +730,12 @@ class WebPlayer {
|
|
|
730
730
|
styleElement.textContent = css.default.toString(); // Assuming css module exports a string
|
|
731
731
|
this.dom.head.appendChild(styleElement);
|
|
732
732
|
}).then(() => {
|
|
733
|
-
return import('./video.es-
|
|
733
|
+
return import('./video.es-be70c095.js');
|
|
734
734
|
}).then(videojs => {
|
|
735
735
|
window.videojs = videojs.default;
|
|
736
736
|
this.videojsLoaded = true;
|
|
737
737
|
}).then(() => {
|
|
738
|
-
return import('./
|
|
739
|
-
}).then(() => {
|
|
740
|
-
return import('./plugin-ca799d0d.js');
|
|
738
|
+
return import('./plugin-50e1316e.js');
|
|
741
739
|
}).then(() => {
|
|
742
740
|
return this.loadWebRTCComponents();
|
|
743
741
|
});
|
|
@@ -800,7 +798,7 @@ class WebPlayer {
|
|
|
800
798
|
this.videojsPlayer.pause();
|
|
801
799
|
setTimeout(() => {
|
|
802
800
|
this.videojsPlayer.play();
|
|
803
|
-
},
|
|
801
|
+
}, 2000);
|
|
804
802
|
}
|
|
805
803
|
}
|
|
806
804
|
|
|
@@ -927,8 +925,8 @@ class WebPlayer {
|
|
|
927
925
|
};
|
|
928
926
|
this.videojsPlayer.ready(() => {
|
|
929
927
|
// If it's already added to player, no need to add again
|
|
930
|
-
if (typeof this.videojsPlayer.
|
|
931
|
-
this.videojsPlayer.
|
|
928
|
+
if (typeof this.videojsPlayer.qualitySelectorHls === "function") {
|
|
929
|
+
this.videojsPlayer.qualitySelectorHls({
|
|
932
930
|
displayCurrentQuality: true
|
|
933
931
|
});
|
|
934
932
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export declare class WebPlayer {
|
|
|
8
8
|
* streamsFolder: streams folder. Optional. Default value is "streams"
|
|
9
9
|
*/
|
|
10
10
|
static STREAMS_FOLDER: string;
|
|
11
|
+
/**
|
|
12
|
+
* lowLatencyHlsFolder: ll-hls folder. Optional. Default value is "ll-hls"
|
|
13
|
+
*/
|
|
14
|
+
static LL_HLS_FOLDER: string;
|
|
11
15
|
constructor(configOrWindow: any, containerElement: any, placeHolderElement: any);
|
|
12
16
|
/**
|
|
13
17
|
* Video HTML content. It's by default STATIC_VIDEO_HTML
|
|
@@ -19,7 +23,7 @@ export declare class WebPlayer {
|
|
|
19
23
|
videoPlayerId: any;
|
|
20
24
|
/**
|
|
21
25
|
* "playOrder": the order which technologies is used in playing. Optional. Default value is "webrtc,hls".
|
|
22
|
-
* possible values are "hls,webrtc","webrtc","hls","vod","dash"
|
|
26
|
+
* possible values are "hls,webrtc","webrtc","hls","ll-hls","vod","dash",
|
|
23
27
|
* It will be taken from url parameter "playOrder".
|
|
24
28
|
*/
|
|
25
29
|
playOrder: any;
|
|
@@ -125,6 +129,10 @@ export declare class WebPlayer {
|
|
|
125
129
|
* Field to keep if tryNextMethod is already called
|
|
126
130
|
*/
|
|
127
131
|
tryNextTechTimer: any;
|
|
132
|
+
/**
|
|
133
|
+
* Listener for ID3 text data
|
|
134
|
+
*/
|
|
135
|
+
id3Listener: any;
|
|
128
136
|
/**
|
|
129
137
|
* REST API Filter JWT
|
|
130
138
|
*/
|
|
@@ -183,6 +191,7 @@ export declare class WebPlayer {
|
|
|
183
191
|
* @returns
|
|
184
192
|
*/
|
|
185
193
|
playWithVideoJS(streamUrl: any, extension: any): void;
|
|
194
|
+
listenForID3MetaData(): void;
|
|
186
195
|
makeVideoJSVisibleWhenReady(): void;
|
|
187
196
|
/**
|
|
188
197
|
* check if stream exists via http
|
|
@@ -247,6 +256,11 @@ export declare class WebPlayer {
|
|
|
247
256
|
* @param {*} webRTCDataListener
|
|
248
257
|
*/
|
|
249
258
|
addWebRTCDataListener(webRTCDataListener: any): void;
|
|
259
|
+
/**
|
|
260
|
+
* ID3 meta data listener
|
|
261
|
+
* @param {*} id3Listener
|
|
262
|
+
*/
|
|
263
|
+
addId3Listener(id3Listener: any): void;
|
|
250
264
|
/**
|
|
251
265
|
*
|
|
252
266
|
* @param {*} data
|
|
@@ -258,6 +272,8 @@ export declare class WebPlayer {
|
|
|
258
272
|
initPtzControls(): void;
|
|
259
273
|
isIpCameraBroadcast(): void;
|
|
260
274
|
moveCamera(valueX: any, valueY: any, valueZ: any, movement: any): void;
|
|
275
|
+
getSource(): any;
|
|
276
|
+
getTime(): any;
|
|
261
277
|
}
|
|
262
278
|
|
|
263
279
|
export { }
|
|
@@ -1,153 +1,130 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var video_es = require('./video.es-474303e7.js');
|
|
3
|
+
var video_es = require('./video.es-df9af03d.js');
|
|
5
4
|
require('./_commonjsHelpers-ed042b00.js');
|
|
6
5
|
|
|
7
|
-
var version = "
|
|
8
|
-
|
|
9
|
-
var MenuButton = video_es.videojs.getComponent('MenuButton');
|
|
10
|
-
var Menu = video_es.videojs.getComponent('Menu');
|
|
11
|
-
var Component = video_es.videojs.getComponent('Component');
|
|
12
|
-
var Dom = video_es.videojs.dom;
|
|
6
|
+
var version = "1.1.1";
|
|
13
7
|
|
|
8
|
+
var VideoJsButtonClass = video_es.default.getComponent('MenuButton');
|
|
9
|
+
var VideoJsMenuClass = video_es.default.getComponent('Menu');
|
|
10
|
+
var VideoJsComponent = video_es.default.getComponent('Component');
|
|
11
|
+
var Dom = video_es.default.dom;
|
|
14
12
|
/**
|
|
15
13
|
* Convert string to title case.
|
|
16
14
|
*
|
|
17
15
|
* @param {string} string - the string to convert
|
|
18
16
|
* @return {string} the returned titlecase string
|
|
19
17
|
*/
|
|
18
|
+
|
|
20
19
|
function toTitleCase(string) {
|
|
21
20
|
if (typeof string !== 'string') {
|
|
22
21
|
return string;
|
|
23
22
|
}
|
|
24
23
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
/**
|
|
28
|
-
*
|
|
26
|
+
* Convert string to title case.
|
|
27
|
+
*
|
|
28
|
+
* @param {Player} player - the string to convert
|
|
29
|
+
* @return {MenuButton} the returned titlecase string
|
|
29
30
|
*/
|
|
30
|
-
var ConcreteButton = /*#__PURE__*/function (_MenuButton) {
|
|
31
|
-
inheritsLoose._inheritsLoose(ConcreteButton, _MenuButton);
|
|
32
|
-
/**
|
|
33
|
-
* Button constructor.
|
|
34
|
-
*
|
|
35
|
-
* @param {Player} player - videojs player instance
|
|
36
|
-
*/
|
|
37
|
-
function ConcreteButton(player) {
|
|
38
|
-
return _MenuButton.call(this, player, {
|
|
39
|
-
title: player.localize('Quality'),
|
|
40
|
-
name: 'QualityButton'
|
|
41
|
-
}) || this;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Creates button items.
|
|
46
|
-
*
|
|
47
|
-
* @return {Array} - Button items
|
|
48
|
-
*/
|
|
49
|
-
var _proto = ConcreteButton.prototype;
|
|
50
|
-
_proto.createItems = function createItems() {
|
|
51
|
-
return [];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Create the menu and add all items to it.
|
|
56
|
-
*
|
|
57
|
-
* @return {Menu}
|
|
58
|
-
* The constructed menu
|
|
59
|
-
*/;
|
|
60
|
-
_proto.createMenu = function createMenu() {
|
|
61
|
-
var menu = new Menu(this.player_, {
|
|
62
|
-
menuButton: this
|
|
63
|
-
});
|
|
64
|
-
this.hideThreshold_ = 0;
|
|
65
31
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
32
|
+
function ConcreteButton(player) {
|
|
33
|
+
var _this = this;
|
|
34
|
+
var ConcreteButtonInit = new VideoJsButtonClass(player, {
|
|
35
|
+
title: player.localize('Quality'),
|
|
36
|
+
name: 'QualityButton',
|
|
37
|
+
createItems: function createItems() {
|
|
38
|
+
return [];
|
|
39
|
+
},
|
|
40
|
+
createMenu: function createMenu() {
|
|
41
|
+
var menu = new VideoJsMenuClass(_this.player_, {
|
|
42
|
+
menuButton: _this
|
|
72
43
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
44
|
+
_this.hideThreshold_ = 0; // Add a title list item to the top
|
|
45
|
+
|
|
46
|
+
if (_this.options_.title) {
|
|
47
|
+
var titleEl = Dom.createEl('li', {
|
|
48
|
+
className: 'vjs-menu-title',
|
|
49
|
+
innerHTML: toTitleCase(_this.options_.title),
|
|
50
|
+
tabIndex: -1
|
|
51
|
+
});
|
|
52
|
+
var titleComponent = new VideoJsComponent(_this.player_, {
|
|
53
|
+
el: titleEl
|
|
54
|
+
});
|
|
55
|
+
_this.hideThreshold_ += 1;
|
|
56
|
+
menu.addItem(titleComponent);
|
|
57
|
+
}
|
|
58
|
+
_this.items = _this.createItems();
|
|
59
|
+
if (_this.items) {
|
|
60
|
+
// Add menu items to the menu
|
|
61
|
+
for (var i = 0; i < _this.items.length; i++) {
|
|
62
|
+
menu.addItem(_this.items[i]);
|
|
63
|
+
}
|
|
84
64
|
}
|
|
65
|
+
return menu;
|
|
85
66
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}(MenuButton);
|
|
90
|
-
|
|
91
|
-
// Concrete classes
|
|
92
|
-
var VideoJsMenuItemClass = video_es.videojs.getComponent('MenuItem');
|
|
67
|
+
});
|
|
68
|
+
return ConcreteButtonInit;
|
|
69
|
+
}
|
|
93
70
|
|
|
71
|
+
var VideoJsMenuItemClass = video_es.default.getComponent('MenuItem');
|
|
94
72
|
/**
|
|
95
|
-
*
|
|
73
|
+
* Create a QualitySelectorHls plugin instance.
|
|
74
|
+
*
|
|
75
|
+
* @param {player} player
|
|
76
|
+
* A Video.js Player instance.
|
|
77
|
+
*
|
|
78
|
+
* @param {item} [item]
|
|
79
|
+
* The Item Quality Item
|
|
80
|
+
*
|
|
81
|
+
* @param {qualityButton} [qualityButton]
|
|
82
|
+
* ConcreteButton
|
|
83
|
+
*
|
|
84
|
+
* @param {plugin} plugin
|
|
85
|
+
* Plugin
|
|
86
|
+
*
|
|
87
|
+
* @return {MenuItem} MenuItem
|
|
88
|
+
* VideoJS Menu Item Class
|
|
96
89
|
*/
|
|
97
|
-
var ConcreteMenuItem = /*#__PURE__*/function (_VideoJsMenuItemClass) {
|
|
98
|
-
inheritsLoose._inheritsLoose(ConcreteMenuItem, _VideoJsMenuItemClass);
|
|
99
|
-
/**
|
|
100
|
-
* Menu item constructor.
|
|
101
|
-
*
|
|
102
|
-
* @param {Player} player - vjs player
|
|
103
|
-
* @param {Object} item - Item object
|
|
104
|
-
* @param {ConcreteButton} qualityButton - The containing button.
|
|
105
|
-
* @param {HlsQualitySelector} plugin - This plugin instance.
|
|
106
|
-
*/
|
|
107
|
-
function ConcreteMenuItem(player, item, qualityButton, plugin) {
|
|
108
|
-
var _this;
|
|
109
|
-
_this = _VideoJsMenuItemClass.call(this, player, {
|
|
110
|
-
label: item.label,
|
|
111
|
-
selectable: true,
|
|
112
|
-
selected: item.selected || false
|
|
113
|
-
}) || this;
|
|
114
|
-
_this.item = item;
|
|
115
|
-
_this.qualityButton = qualityButton;
|
|
116
|
-
_this.plugin = plugin;
|
|
117
|
-
return _this;
|
|
118
|
-
}
|
|
119
90
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
91
|
+
function ConcreteMenuItem(player, item, qualityButton, plugin) {
|
|
92
|
+
var ConcreteMenuItemInit = new VideoJsMenuItemClass(player, {
|
|
93
|
+
label: item.label,
|
|
94
|
+
selectable: true,
|
|
95
|
+
selected: item.selected || false
|
|
96
|
+
});
|
|
97
|
+
ConcreteMenuItemInit.item = item;
|
|
98
|
+
ConcreteMenuItemInit.qualityButton = qualityButton;
|
|
99
|
+
ConcreteMenuItemInit.plugin = plugin;
|
|
100
|
+
ConcreteMenuItemInit.handleClick = function () {
|
|
125
101
|
// Reset other menu items selected status.
|
|
126
102
|
for (var i = 0; i < this.qualityButton.items.length; ++i) {
|
|
127
103
|
this.qualityButton.items[i].selected(false);
|
|
128
|
-
}
|
|
104
|
+
} // Set this menu item to selected, and set quality.
|
|
129
105
|
|
|
130
|
-
// Set this menu item to selected, and set quality.
|
|
131
106
|
this.plugin.setQuality(this.item.value);
|
|
132
107
|
this.selected(true);
|
|
133
108
|
};
|
|
134
|
-
return
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
var Plugin = video_es.videojs.getPlugin('plugin');
|
|
109
|
+
return ConcreteMenuItemInit;
|
|
110
|
+
}
|
|
138
111
|
|
|
139
112
|
// Default options for the plugin.
|
|
140
|
-
var defaults = {};
|
|
141
113
|
|
|
114
|
+
var defaults = {
|
|
115
|
+
vjsIconClass: 'vjs-icon-hd',
|
|
116
|
+
displayCurrentQuality: false,
|
|
117
|
+
placementIndex: 0
|
|
118
|
+
};
|
|
142
119
|
/**
|
|
143
120
|
* An advanced Video.js plugin. For more information on the API
|
|
144
121
|
*
|
|
145
122
|
* See: https://blog.videojs.com/feature-spotlight-advanced-plugins/
|
|
146
123
|
*/
|
|
147
|
-
|
|
148
|
-
|
|
124
|
+
|
|
125
|
+
var QualitySelectorHlsClass = /*#__PURE__*/function () {
|
|
149
126
|
/**
|
|
150
|
-
* Create a
|
|
127
|
+
* Create a QualitySelectorHls plugin instance.
|
|
151
128
|
*
|
|
152
129
|
* @param {Player} player
|
|
153
130
|
* A Video.js Player instance.
|
|
@@ -159,31 +136,39 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
|
|
|
159
136
|
* second argument of options is a convenient way to accept inputs
|
|
160
137
|
* from your plugin's caller.
|
|
161
138
|
*/
|
|
162
|
-
function
|
|
163
|
-
var _this;
|
|
139
|
+
function QualitySelectorHlsClass(player, options) {
|
|
140
|
+
var _this = this;
|
|
141
|
+
|
|
164
142
|
// the parent class will add player under this.player
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
143
|
+
this.player = player;
|
|
144
|
+
this.config = video_es.default.obj.merge(defaults, options);
|
|
145
|
+
player.ready(function () {
|
|
146
|
+
_this.player.addClass('vjs-quality-selector-hls');
|
|
169
147
|
if (_this.player.qualityLevels) {
|
|
170
|
-
_this.player.addClass('vjs-hls-quality-selector');
|
|
171
148
|
// Create the quality button.
|
|
172
149
|
_this.createQualityButton();
|
|
173
150
|
_this.bindPlayerEvents();
|
|
174
151
|
}
|
|
175
152
|
});
|
|
176
|
-
return _this;
|
|
177
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Returns HLS Plugin
|
|
156
|
+
*
|
|
157
|
+
* @return {*} - videojs-hls-contrib plugin.
|
|
158
|
+
*/
|
|
178
159
|
|
|
160
|
+
var _proto = QualitySelectorHlsClass.prototype;
|
|
161
|
+
_proto.getHls = function getHls() {
|
|
162
|
+
return this.player.tech({
|
|
163
|
+
IWillNotUseThisInPlugins: true
|
|
164
|
+
}).hls;
|
|
165
|
+
}
|
|
179
166
|
/**
|
|
180
167
|
* Binds listener for quality level changes.
|
|
181
|
-
|
|
182
|
-
var _proto = HlsQualitySelector.prototype;
|
|
168
|
+
*/;
|
|
183
169
|
_proto.bindPlayerEvents = function bindPlayerEvents() {
|
|
184
170
|
this.player.qualityLevels().on('addqualitylevel', this.onAddQualityLevel.bind(this));
|
|
185
171
|
}
|
|
186
|
-
|
|
187
172
|
/**
|
|
188
173
|
* Adds the quality menu button to the player control bar.
|
|
189
174
|
*/;
|
|
@@ -193,26 +178,24 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
|
|
|
193
178
|
var placementIndex = player.controlBar.children().length - 2;
|
|
194
179
|
var concreteButtonInstance = player.controlBar.addChild(this._qualityButton, {
|
|
195
180
|
componentClass: 'qualitySelector'
|
|
196
|
-
}, this.
|
|
181
|
+
}, this.config.placementIndex || placementIndex);
|
|
197
182
|
concreteButtonInstance.addClass('vjs-quality-selector');
|
|
198
|
-
if (!this.
|
|
199
|
-
var icon = " " + (this.
|
|
183
|
+
if (!this.config.displayCurrentQuality) {
|
|
184
|
+
var icon = " " + (this.config.vjsIconClass || 'vjs-icon-hd');
|
|
200
185
|
concreteButtonInstance.menuButton_.$('.vjs-icon-placeholder').className += icon;
|
|
201
186
|
} else {
|
|
202
|
-
this.setButtonInnerText(
|
|
187
|
+
this.setButtonInnerText('auto');
|
|
203
188
|
}
|
|
204
189
|
concreteButtonInstance.removeClass('vjs-hidden');
|
|
205
190
|
}
|
|
206
|
-
|
|
207
191
|
/**
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
192
|
+
*Set inner button text.
|
|
193
|
+
*
|
|
194
|
+
* @param {string} text - the text to display in the button.
|
|
195
|
+
*/;
|
|
212
196
|
_proto.setButtonInnerText = function setButtonInnerText(text) {
|
|
213
197
|
this._qualityButton.menuButton_.$('.vjs-icon-placeholder').innerHTML = text;
|
|
214
198
|
}
|
|
215
|
-
|
|
216
199
|
/**
|
|
217
200
|
* Builds individual quality menu items.
|
|
218
201
|
*
|
|
@@ -221,9 +204,8 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
|
|
|
221
204
|
*/;
|
|
222
205
|
_proto.getQualityMenuItem = function getQualityMenuItem(item) {
|
|
223
206
|
var player = this.player;
|
|
224
|
-
return
|
|
207
|
+
return ConcreteMenuItem(player, item, this._qualityButton, this);
|
|
225
208
|
}
|
|
226
|
-
|
|
227
209
|
/**
|
|
228
210
|
* Executed when a quality level is added from HLS playlist.
|
|
229
211
|
*/;
|
|
@@ -233,13 +215,13 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
|
|
|
233
215
|
var qualityList = player.qualityLevels();
|
|
234
216
|
var levels = qualityList.levels_ || [];
|
|
235
217
|
var levelItems = [];
|
|
236
|
-
var _loop = function _loop() {
|
|
218
|
+
var _loop = function _loop(i) {
|
|
237
219
|
var _levels$i = levels[i],
|
|
238
220
|
width = _levels$i.width,
|
|
239
221
|
height = _levels$i.height;
|
|
240
222
|
var pixels = width > height ? height : width;
|
|
241
223
|
if (!pixels) {
|
|
242
|
-
return
|
|
224
|
+
return "continue";
|
|
243
225
|
}
|
|
244
226
|
if (!levelItems.filter(function (_existingItem) {
|
|
245
227
|
return _existingItem.item && _existingItem.item.value === pixels;
|
|
@@ -252,7 +234,8 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
|
|
|
252
234
|
}
|
|
253
235
|
};
|
|
254
236
|
for (var i = 0; i < levels.length; ++i) {
|
|
255
|
-
|
|
237
|
+
var _ret = _loop(i);
|
|
238
|
+
if (_ret === "continue") continue;
|
|
256
239
|
}
|
|
257
240
|
levelItems.sort(function (current, next) {
|
|
258
241
|
if (typeof current !== 'object' || typeof next !== 'object') {
|
|
@@ -267,7 +250,7 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
|
|
|
267
250
|
return 0;
|
|
268
251
|
});
|
|
269
252
|
levelItems.push(this.getQualityMenuItem.call(this, {
|
|
270
|
-
label:
|
|
253
|
+
label: player.localize('Auto'),
|
|
271
254
|
value: 'auto',
|
|
272
255
|
selected: true
|
|
273
256
|
}));
|
|
@@ -278,19 +261,17 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
|
|
|
278
261
|
this._qualityButton.update();
|
|
279
262
|
}
|
|
280
263
|
}
|
|
281
|
-
|
|
282
264
|
/**
|
|
283
265
|
* Sets quality (based on media short side)
|
|
284
266
|
*
|
|
285
267
|
* @param {number} quality - A number representing HLS playlist.
|
|
286
268
|
*/;
|
|
287
269
|
_proto.setQuality = function setQuality(quality) {
|
|
288
|
-
var qualityList = this.player.qualityLevels();
|
|
270
|
+
var qualityList = this.player.qualityLevels(); // Set quality on plugin
|
|
289
271
|
|
|
290
|
-
// Set quality on plugin
|
|
291
272
|
this._currentQuality = quality;
|
|
292
|
-
if (this.
|
|
293
|
-
this.setButtonInnerText(quality === 'auto' ?
|
|
273
|
+
if (this.config.displayCurrentQuality) {
|
|
274
|
+
this.setButtonInnerText(quality === 'auto' ? quality : quality + "p");
|
|
294
275
|
}
|
|
295
276
|
for (var i = 0; i < qualityList.length; ++i) {
|
|
296
277
|
var _qualityList$i = qualityList[i],
|
|
@@ -301,7 +282,6 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
|
|
|
301
282
|
}
|
|
302
283
|
this._qualityButton.unpressButton();
|
|
303
284
|
}
|
|
304
|
-
|
|
305
285
|
/**
|
|
306
286
|
* Return the current set quality or 'auto'
|
|
307
287
|
*
|
|
@@ -310,11 +290,21 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
|
|
|
310
290
|
_proto.getCurrentQuality = function getCurrentQuality() {
|
|
311
291
|
return this._currentQuality || 'auto';
|
|
312
292
|
};
|
|
313
|
-
return
|
|
314
|
-
}(
|
|
315
|
-
|
|
293
|
+
return QualitySelectorHlsClass;
|
|
294
|
+
}();
|
|
295
|
+
var initPlugin = function initPlugin(player, options) {
|
|
296
|
+
var QualitySelectorHls = new QualitySelectorHlsClass(player, options);
|
|
297
|
+
player.QualitySelectorHlsVjs = true; // Define default values for the plugin's `state` object here.
|
|
298
|
+
|
|
299
|
+
QualitySelectorHls.defaultState = {}; // Include the version number.
|
|
300
|
+
|
|
301
|
+
QualitySelectorHls.VERSION = version;
|
|
302
|
+
return QualitySelectorHls;
|
|
303
|
+
};
|
|
304
|
+
var QualitySelectorHls = function QualitySelectorHls(options) {
|
|
305
|
+
return initPlugin(this, video_es.default.obj.merge({}, options));
|
|
306
|
+
}; // Register the plugin with video.js.
|
|
316
307
|
|
|
317
|
-
|
|
318
|
-
video_es.videojs.registerPlugin('hlsQualitySelector', HlsQualitySelector);
|
|
308
|
+
video_es.default.registerPlugin('qualitySelectorHls', QualitySelectorHls);
|
|
319
309
|
|
|
320
|
-
exports.default =
|
|
310
|
+
exports.default = QualitySelectorHls;
|