@flashphoner/websdk 2.0.244 → 2.0.246
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/docTemplate/README.md +1 -1
- package/examples/demo/streaming/hls-js-player/hls-js-player.js +79 -1
- package/examples/demo/streaming/hls-player/hls-player.js +135 -12
- package/examples/demo/streaming/hls-player/player-page.html +27 -12
- package/examples/demo/streaming/hls-player/videojs7/videojs-contrib-quality-levels.js +308 -0
- package/flashphoner-no-flash.js +606 -136
- package/flashphoner-no-flash.min.js +2 -2
- package/flashphoner-no-webrtc.js +554 -130
- package/flashphoner-no-webrtc.min.js +2 -2
- package/flashphoner-no-wsplayer.js +605 -135
- package/flashphoner-no-wsplayer.min.js +2 -2
- package/flashphoner-room-api.js +366 -18
- package/flashphoner-room-api.min.js +2 -2
- package/flashphoner-temasys-flash-websocket-without-adapterjs.js +555 -131
- package/flashphoner-temasys-flash-websocket.js +554 -130
- package/flashphoner-temasys-flash-websocket.min.js +1 -1
- package/flashphoner-webrtc-only.js +604 -134
- package/flashphoner-webrtc-only.min.js +1 -1
- package/flashphoner.js +606 -136
- package/flashphoner.min.js +2 -2
- package/package.json +1 -1
- package/src/client-info.js +237 -0
- package/src/flashphoner-core.js +83 -5
- package/src/webrtc-media-provider.js +37 -5
|
@@ -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
|
+
})));
|