ovenplayer 0.10.0 → 0.10.5
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/ovenplayer.js +1 -1
- package/dist/ovenplayer.js.map +1 -1
- package/package.json +3 -3
- package/src/assets/fonts/seek-icons.svg +13 -13
- package/src/js/api/Api.js +51 -90
- package/src/js/api/Configurator.js +3 -1
- package/src/js/api/provider/html5/Provider.js +19 -33
- package/src/js/api/provider/html5/providers/Dash.js +36 -113
- package/src/js/api/provider/html5/providers/Hls.js +19 -107
- package/src/js/api/provider/html5/providers/WebRTC.js +1 -9
- package/src/js/api/provider/html5/providers/WebRTCLoader.js +7 -5
- package/src/js/ovenplayer.js +4 -1
- package/src/js/utils/underscore.js +5 -5
- package/src/js/view/components/controls/volumeButton.js +0 -3
- package/src/js/view/components/helpers/main.js +10 -7
- package/src/js/view/view.js +16 -1
- package/src/stylesheet/ovenplayer.less +8 -1
- package/dist/report.html +0 -53
- package/src/js/api/provider/flash/Listener.js +0 -80
- package/src/js/api/provider/flash/Provider.js +0 -443
- package/src/js/api/provider/flash/providers/Rtmp.js +0 -50
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by hoho on 2018. 8. 27..
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
ERROR,
|
|
6
|
-
STATE_IDLE,
|
|
7
|
-
STATE_PLAYING,
|
|
8
|
-
STATE_STALLED,
|
|
9
|
-
STATE_LOADING,
|
|
10
|
-
STATE_COMPLETE,
|
|
11
|
-
STATE_PAUSED,
|
|
12
|
-
STATE_ERROR,
|
|
13
|
-
CONTENT_COMPLETE,
|
|
14
|
-
CONTENT_SEEK,
|
|
15
|
-
CONTENT_BUFFER_FULL,
|
|
16
|
-
CONTENT_SEEKED,
|
|
17
|
-
CONTENT_BUFFER,
|
|
18
|
-
CONTENT_TIME,
|
|
19
|
-
CONTENT_VOLUME,
|
|
20
|
-
CONTENT_META,
|
|
21
|
-
PLAYER_UNKNWON_ERROR,
|
|
22
|
-
PLAYER_UNKNWON_OPERATION_ERROR,
|
|
23
|
-
PLAYER_UNKNWON_NETWORK_ERROR,
|
|
24
|
-
PLAYER_UNKNWON_DECODE_ERROR,
|
|
25
|
-
PLAYER_FILE_ERROR,
|
|
26
|
-
PLAYER_STATE,
|
|
27
|
-
PROVIDER_HTML5,
|
|
28
|
-
PROVIDER_WEBRTC,
|
|
29
|
-
PROVIDER_DASH,
|
|
30
|
-
PROVIDER_HLS
|
|
31
|
-
} from "api/constants";
|
|
32
|
-
|
|
33
|
-
const Listener = function(elFlash, provider, videoEndedCallback){
|
|
34
|
-
let that = {};
|
|
35
|
-
|
|
36
|
-
that.isJSReady = () =>{
|
|
37
|
-
return true;
|
|
38
|
-
};
|
|
39
|
-
that.timeupdate = (data) =>{
|
|
40
|
-
|
|
41
|
-
elFlash.currentTime = data.position;
|
|
42
|
-
provider.trigger(CONTENT_TIME, data);
|
|
43
|
-
//provider.trigger(CONTENT_BUFFER, data);
|
|
44
|
-
//data.duration-1 : this is trick. because sometimes rtmp's position < duration when video ended.
|
|
45
|
-
//2019-06-07 : Do not use duration-1 trick anymore. I improved SWF player.
|
|
46
|
-
/*if(data.position >= (data.duration-1)){
|
|
47
|
-
if(provider.getState() !== STATE_IDLE && provider.getState() !== STATE_COMPLETE){
|
|
48
|
-
if(videoEndedCallback){
|
|
49
|
-
videoEndedCallback(function(){
|
|
50
|
-
provider.setState(STATE_COMPLETE);
|
|
51
|
-
});
|
|
52
|
-
}else{
|
|
53
|
-
provider.setState(STATE_COMPLETE);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
}*/
|
|
58
|
-
};
|
|
59
|
-
that.volumeChanged = (data) =>{
|
|
60
|
-
provider.trigger(CONTENT_VOLUME, data);
|
|
61
|
-
};
|
|
62
|
-
that.stateChanged = (data) =>{
|
|
63
|
-
provider.setState(data.newstate);
|
|
64
|
-
};
|
|
65
|
-
that.metaChanged = (data) =>{
|
|
66
|
-
provider.trigger(CONTENT_META, data);
|
|
67
|
-
};
|
|
68
|
-
that.error = (error) =>{
|
|
69
|
-
provider.setState(STATE_ERROR);
|
|
70
|
-
provider.pause();
|
|
71
|
-
|
|
72
|
-
//PRIVATE_STATE_ERROR
|
|
73
|
-
provider.trigger(ERROR, error);
|
|
74
|
-
|
|
75
|
-
};
|
|
76
|
-
return that;
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export default Listener;
|
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by hoho on 2018. 8. 23..
|
|
3
|
-
*/
|
|
4
|
-
import Ima from "api/ads/ima/Ad";
|
|
5
|
-
import Vast from "api/ads/vast/Ad";
|
|
6
|
-
import EventEmitter from "api/EventEmitter";
|
|
7
|
-
import EventsListener from "api/provider/flash/Listener";
|
|
8
|
-
import {extractVideoElement, pickCurrentSource} from "api/provider/utils";
|
|
9
|
-
import {
|
|
10
|
-
ERRORS, INIT_RTMP_SETUP_ERROR,
|
|
11
|
-
STATE_IDLE, STATE_PLAYING, STATE_PAUSED, STATE_COMPLETE, STATE_ERROR,
|
|
12
|
-
PLAYER_STATE, PLAYER_COMPLETE, PLAYER_PAUSE, PLAYER_PLAY, STATE_AD_PLAYING, STATE_AD_PAUSED,
|
|
13
|
-
CONTENT_SOURCE_CHANGED, CONTENT_LEVEL_CHANGED, CONTENT_TIME, CONTENT_CAPTION_CUE_CHANGED,
|
|
14
|
-
AD_CLIENT_GOOGLEIMA, AD_CLIENT_VAST,
|
|
15
|
-
PLAYBACK_RATE_CHANGED, CONTENT_MUTE, PROVIDER_HTML5, PROVIDER_WEBRTC, PROVIDER_DASH, PROVIDER_HLS
|
|
16
|
-
} from "api/constants";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @brief Core For Flash Video.
|
|
20
|
-
* @param spec member value
|
|
21
|
-
* @param playerConfig player config
|
|
22
|
-
* */
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const Provider = function(spec, playerConfig){
|
|
26
|
-
OvenPlayerConsole.log("CORE loaded. ");
|
|
27
|
-
|
|
28
|
-
let that = {};
|
|
29
|
-
EventEmitter(that);
|
|
30
|
-
|
|
31
|
-
let elFlash = spec.element;
|
|
32
|
-
let ads = null, listener = null, videoEndedCallback = null;
|
|
33
|
-
|
|
34
|
-
//It means to support ad for flash. Set the same specifications like a Video Tag.
|
|
35
|
-
Object.defineProperty(elFlash, 'currentTime',
|
|
36
|
-
{value :0, writable : true}
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
if(spec.adTagUrl){
|
|
40
|
-
OvenPlayerConsole.log("[Provider] Ad Client - ", playerConfig.getAdClient());
|
|
41
|
-
if(playerConfig.getAdClient() === AD_CLIENT_VAST){
|
|
42
|
-
ads = Vast(elFlash, that, playerConfig, spec.adTagUrl);
|
|
43
|
-
}else{
|
|
44
|
-
ads = Ima(elFlash, that, playerConfig, spec.adTagUrl);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if(!ads){
|
|
48
|
-
console.log("Can not load due to google ima for Ads.");
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
listener = EventsListener(elFlash, that, ads ? ads.videoEndedCallback : null);
|
|
52
|
-
|
|
53
|
-
const _load = (lastPlayPosition) =>{
|
|
54
|
-
|
|
55
|
-
const source = spec.sources[spec.currentSource];
|
|
56
|
-
OvenPlayerConsole.log("source loaded : ", source, "lastPlayPosition : "+ lastPlayPosition);
|
|
57
|
-
const previousSource = elFlash.getCurrentSource();
|
|
58
|
-
|
|
59
|
-
const sourceChanged = (source.file !== previousSource);
|
|
60
|
-
if (sourceChanged) {
|
|
61
|
-
elFlash.load(source.file);
|
|
62
|
-
}else if(lastPlayPosition === 0 && that.getPosition() > 0){
|
|
63
|
-
that.seek(lastPlayPosition);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
//Flash has two init states. FlashLoaded and FileLoaded.
|
|
68
|
-
//_load calls after FlashLoaded. _afterLoad calls after FileLoaded.
|
|
69
|
-
const _afterLoad = function(lastPlayPosition){
|
|
70
|
-
spec.isLoaded = true;
|
|
71
|
-
if(lastPlayPosition > 0){
|
|
72
|
-
if(!playerConfig.isAutoStart()){
|
|
73
|
-
that.play();
|
|
74
|
-
}
|
|
75
|
-
that.seek(lastPlayPosition);
|
|
76
|
-
}
|
|
77
|
-
if(playerConfig.isAutoStart()){
|
|
78
|
-
|
|
79
|
-
that.play();
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
//This is why. Flash does not self trig to ads,lmalm,
|
|
84
|
-
that.triggerEventFromExternal = (funcName, funcData) => {
|
|
85
|
-
if(listener[funcName]){
|
|
86
|
-
return listener[funcName](funcData);
|
|
87
|
-
}else{
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
that.getName = () => {
|
|
92
|
-
return spec.name;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
that.canSeek = () => {
|
|
96
|
-
return spec.canSeek;
|
|
97
|
-
};
|
|
98
|
-
that.setCanSeek = (canSeek) => {
|
|
99
|
-
spec.canSeek = canSeek;
|
|
100
|
-
};
|
|
101
|
-
that.isSeeking = ()=>{
|
|
102
|
-
return spec.seeking;
|
|
103
|
-
};
|
|
104
|
-
that.setSeeking = (seeking)=>{
|
|
105
|
-
spec.seeking = seeking;
|
|
106
|
-
};
|
|
107
|
-
that.setMetaLoaded = () => {
|
|
108
|
-
spec.isLoaded = true;
|
|
109
|
-
}
|
|
110
|
-
that.metaLoaded = () => {
|
|
111
|
-
return spec.isLoaded;
|
|
112
|
-
}
|
|
113
|
-
that.setState = (newState) => {
|
|
114
|
-
if(spec.state !== newState){
|
|
115
|
-
let prevState = spec.state;
|
|
116
|
-
//ToDo : This is temporary code. avoid background content error.
|
|
117
|
-
if(prevState === STATE_AD_PLAYING && (newState === STATE_ERROR || newState === STATE_IDLE) ){
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
/*
|
|
121
|
-
* 2019-06-13
|
|
122
|
-
* No more necessary this codes.
|
|
123
|
-
* Checking the autoPlay support was using main video element. elVideo.play() -> yes or no??
|
|
124
|
-
* And then that causes triggering play and pause event.
|
|
125
|
-
* And that checking waits for elVideo loaded. Dash load completion time is unknown.
|
|
126
|
-
* Then I changed check method. I make temporary video tag and insert empty video.
|
|
127
|
-
* */
|
|
128
|
-
//if ((prevState === STATE_AD_PLAYING || prevState === STATE_AD_PAUSED ) && (newState === STATE_PAUSED || newState === STATE_PLAYING)) {
|
|
129
|
-
// return false;
|
|
130
|
-
//Ads checks checkAutoplaySupport(). It calls real play() and pause() to video element.
|
|
131
|
-
//And then that triggers "playing" and "pause".
|
|
132
|
-
//I prevent these process.
|
|
133
|
-
//}
|
|
134
|
-
switch(newState){
|
|
135
|
-
case STATE_COMPLETE :
|
|
136
|
-
that.trigger(PLAYER_COMPLETE);
|
|
137
|
-
break;
|
|
138
|
-
case STATE_PAUSED :
|
|
139
|
-
that.trigger(PLAYER_PAUSE, {
|
|
140
|
-
prevState: spec.state,
|
|
141
|
-
newstate: STATE_PAUSED
|
|
142
|
-
});
|
|
143
|
-
break;
|
|
144
|
-
case STATE_AD_PAUSED :
|
|
145
|
-
that.trigger(PLAYER_PAUSE, {
|
|
146
|
-
prevState: spec.state,
|
|
147
|
-
newstate: STATE_AD_PAUSED
|
|
148
|
-
});
|
|
149
|
-
break;
|
|
150
|
-
case STATE_PLAYING :
|
|
151
|
-
that.trigger(PLAYER_PLAY, {
|
|
152
|
-
prevState: spec.state,
|
|
153
|
-
newstate: STATE_PLAYING
|
|
154
|
-
});
|
|
155
|
-
case STATE_AD_PLAYING :
|
|
156
|
-
that.trigger(PLAYER_PLAY, {
|
|
157
|
-
prevState: spec.state,
|
|
158
|
-
newstate: STATE_AD_PLAYING
|
|
159
|
-
});
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
spec.state = newState;
|
|
163
|
-
that.trigger(PLAYER_STATE, {
|
|
164
|
-
prevstate : prevState,
|
|
165
|
-
newstate: spec.state
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
that.getState = () =>{
|
|
170
|
-
return spec.state;
|
|
171
|
-
};
|
|
172
|
-
that.setBuffer = (newBuffer) => {
|
|
173
|
-
|
|
174
|
-
};
|
|
175
|
-
that.getBuffer = () => {
|
|
176
|
-
if(!elFlash){
|
|
177
|
-
return ;
|
|
178
|
-
}
|
|
179
|
-
return elFlash.getBuffer ? elFlash.getBuffer() : null;
|
|
180
|
-
};
|
|
181
|
-
that.getDuration = () => {
|
|
182
|
-
if(!elFlash){
|
|
183
|
-
return ;
|
|
184
|
-
}
|
|
185
|
-
return elFlash.getDuration ? elFlash.getDuration() : 0;
|
|
186
|
-
};
|
|
187
|
-
that.getPosition = () => {
|
|
188
|
-
if(!elFlash){
|
|
189
|
-
return ;
|
|
190
|
-
}
|
|
191
|
-
return elFlash.getPosition ? elFlash.getPosition() : 0;
|
|
192
|
-
};
|
|
193
|
-
that.setVolume = (volume) => {
|
|
194
|
-
if(!elFlash){
|
|
195
|
-
return ;
|
|
196
|
-
}
|
|
197
|
-
return elFlash.setVolume ? elFlash.setVolume(volume) : 0;
|
|
198
|
-
};
|
|
199
|
-
that.getVolume = () => {
|
|
200
|
-
if(!elFlash){
|
|
201
|
-
return ;
|
|
202
|
-
}
|
|
203
|
-
return elFlash.setVolume ? elFlash.getVolume() : 0;
|
|
204
|
-
};
|
|
205
|
-
that.setMute = () =>{
|
|
206
|
-
if(!elFlash){
|
|
207
|
-
return ;
|
|
208
|
-
}
|
|
209
|
-
elFlash.setMute();
|
|
210
|
-
};
|
|
211
|
-
that.getMute = () =>{
|
|
212
|
-
if(!elFlash){
|
|
213
|
-
return ;
|
|
214
|
-
}
|
|
215
|
-
return elFlash.getMute ? elFlash.getMute() : false;
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
that.preload = (sources, lastPlayPosition) =>{
|
|
219
|
-
OvenPlayerConsole.log("CORE : preload() ", sources, lastPlayPosition);
|
|
220
|
-
let retryCount = 0;
|
|
221
|
-
|
|
222
|
-
spec.sources = sources;
|
|
223
|
-
spec.currentSource = pickCurrentSource(sources, playerConfig);
|
|
224
|
-
|
|
225
|
-
return new Promise(function (resolve, reject) {
|
|
226
|
-
//First : checkSwfIsReady -> It checks swf loading complete by polling.
|
|
227
|
-
//Second : checkFileLoaded -> It checks src loading complete by polling too.
|
|
228
|
-
//Why complex is it? -> It againsts flash timing issue.
|
|
229
|
-
(function checkSwfIsReady(){
|
|
230
|
-
retryCount ++;
|
|
231
|
-
if(elFlash.isFlashReady && elFlash.isFlashReady()){
|
|
232
|
-
Object.defineProperty(elFlash, 'duration',
|
|
233
|
-
{value :elFlash.getDuration()}
|
|
234
|
-
);
|
|
235
|
-
_load(lastPlayPosition || 0);
|
|
236
|
-
retryCount = 0;
|
|
237
|
-
|
|
238
|
-
return (function checkFileLoaded(){
|
|
239
|
-
retryCount ++;
|
|
240
|
-
if(elFlash.isFileLoaded && elFlash.isFileLoaded()){
|
|
241
|
-
_afterLoad(lastPlayPosition);
|
|
242
|
-
if(playerConfig.isMute()){
|
|
243
|
-
that.setMute(true);
|
|
244
|
-
}
|
|
245
|
-
if(playerConfig.getVolume() && playerConfig.getVolume() < 100){
|
|
246
|
-
that.setVolume(playerConfig.getVolume());
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return resolve();
|
|
250
|
-
}else{
|
|
251
|
-
|
|
252
|
-
if(retryCount < 300){
|
|
253
|
-
setTimeout(checkFileLoaded, 100);
|
|
254
|
-
}else{
|
|
255
|
-
return reject(ERRORS.codes[INIT_RTMP_SETUP_ERROR]);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
})();
|
|
259
|
-
|
|
260
|
-
}else{
|
|
261
|
-
if(retryCount < 100){
|
|
262
|
-
setTimeout(checkSwfIsReady, 100);
|
|
263
|
-
}else{
|
|
264
|
-
return reject(ERRORS.codes[INIT_RTMP_SETUP_ERROR]);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
})();
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
that.load = (sources) =>{
|
|
272
|
-
spec.sources = sources;
|
|
273
|
-
spec.currentSource = pickCurrentSource(sources, playerConfig);
|
|
274
|
-
_load(0);
|
|
275
|
-
_afterLoad(0);
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
that.play = () =>{
|
|
279
|
-
if(!elFlash){
|
|
280
|
-
return false;
|
|
281
|
-
}
|
|
282
|
-
if(that.getState() !== STATE_PLAYING){
|
|
283
|
-
if ( (ads && ads.isActive()) || (ads && !ads.started()) ) {
|
|
284
|
-
ads.play();
|
|
285
|
-
}else{
|
|
286
|
-
elFlash.play();
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
that.pause = () =>{
|
|
292
|
-
if(!elFlash){
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
if (that.getState() === STATE_PLAYING) {
|
|
296
|
-
elFlash.pause();
|
|
297
|
-
}else if(that.getState() === STATE_AD_PLAYING){
|
|
298
|
-
ads.pause();
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
};
|
|
302
|
-
that.seek = (position) =>{
|
|
303
|
-
elFlash.seek(position);
|
|
304
|
-
};
|
|
305
|
-
that.setPlaybackRate = (playbackRate) =>{
|
|
306
|
-
return 0;
|
|
307
|
-
};
|
|
308
|
-
that.getPlaybackRate = () =>{
|
|
309
|
-
return 0;
|
|
310
|
-
};
|
|
311
|
-
that.getSources = () => {
|
|
312
|
-
if(!elFlash){
|
|
313
|
-
return [];
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
return spec.sources.map(function(source, index) {
|
|
317
|
-
return {
|
|
318
|
-
file: source.file,
|
|
319
|
-
type: source.type,
|
|
320
|
-
label: source.label,
|
|
321
|
-
index : index
|
|
322
|
-
};
|
|
323
|
-
});
|
|
324
|
-
};
|
|
325
|
-
that.getCurrentSource = () =>{
|
|
326
|
-
return spec.currentSource;
|
|
327
|
-
};
|
|
328
|
-
that.setCurrentSource = (sourceIndex, needProviderChange) => {
|
|
329
|
-
if(spec.currentQuality === sourceIndex){
|
|
330
|
-
return false;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
if(sourceIndex > -1){
|
|
334
|
-
if(spec.sources && spec.sources.length > sourceIndex){
|
|
335
|
-
that.pause();
|
|
336
|
-
that.setState(STATE_IDLE);
|
|
337
|
-
OvenPlayerConsole.log("source changed : " + sourceIndex);
|
|
338
|
-
spec.currentSource = sourceIndex;
|
|
339
|
-
|
|
340
|
-
that.trigger(CONTENT_SOURCE_CHANGED, {
|
|
341
|
-
currentSource: sourceIndex
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
playerConfig.setSourceIndex(sourceIndex);
|
|
345
|
-
//playerConfig.setSourceLabel(spec.sources[sourceIndex].label);
|
|
346
|
-
|
|
347
|
-
if(needProviderChange){
|
|
348
|
-
let lastPlayPosition = elFlash.getCurrentTime()|| 0;
|
|
349
|
-
let retryCount = 0;
|
|
350
|
-
_load(lastPlayPosition);
|
|
351
|
-
|
|
352
|
-
(function checkFileLoaded(){
|
|
353
|
-
retryCount ++;
|
|
354
|
-
if(elFlash.isFileLoaded && elFlash.isFileLoaded()){
|
|
355
|
-
_afterLoad(lastPlayPosition);
|
|
356
|
-
}else{
|
|
357
|
-
|
|
358
|
-
if(retryCount < 300){
|
|
359
|
-
setTimeout(checkFileLoaded, 100);
|
|
360
|
-
}else{
|
|
361
|
-
console.log("FileLoad failed");
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
})();
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
return spec.currentSource;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
that.getQualityLevels = () => {
|
|
373
|
-
if(!elFlash){
|
|
374
|
-
return [];
|
|
375
|
-
}
|
|
376
|
-
return spec.qualityLevels;
|
|
377
|
-
};
|
|
378
|
-
that.getCurrentQuality = () => {
|
|
379
|
-
if(!elFlash){
|
|
380
|
-
return null;
|
|
381
|
-
}
|
|
382
|
-
return spec.currentQuality;
|
|
383
|
-
};
|
|
384
|
-
that.setCurrentQuality = (qualityIndex) => {
|
|
385
|
-
//Do nothing
|
|
386
|
-
};
|
|
387
|
-
that.isAutoQuality = () => {
|
|
388
|
-
//Do nothing
|
|
389
|
-
};
|
|
390
|
-
that.setAutoQuality = (isAuto) => {
|
|
391
|
-
//Do nothing
|
|
392
|
-
};
|
|
393
|
-
that.getFramerate = () => {
|
|
394
|
-
return spec.framerate;
|
|
395
|
-
};
|
|
396
|
-
that.setFramerate = (framerate) => {
|
|
397
|
-
return spec.framerate = framerate;
|
|
398
|
-
};
|
|
399
|
-
that.seekFrame = (frameCount) =>{
|
|
400
|
-
let fps = spec.framerate;
|
|
401
|
-
let currentFrames = elFlash.getCurrentTime() * fps;
|
|
402
|
-
let newPosition = (currentFrames + frameCount) / fps;
|
|
403
|
-
newPosition = newPosition + 0.00001; // FIXES A SAFARI SEEK ISSUE. myVdieo.currentTime = 0.04 would give SMPTE 00:00:00:00 wheras it should give 00:00:00:01
|
|
404
|
-
|
|
405
|
-
that.pause();
|
|
406
|
-
that.seek(newPosition);
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
that.stop = () =>{
|
|
410
|
-
OvenPlayerConsole.log("CORE : stop() ");
|
|
411
|
-
elFlash.stop();
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
that.destroy = () =>{
|
|
415
|
-
OvenPlayerConsole.log("CORE : destroy() player stop, listener, event destroied");
|
|
416
|
-
that.stop();
|
|
417
|
-
|
|
418
|
-
/*try{
|
|
419
|
-
elFlash.remove();
|
|
420
|
-
}catch(error){
|
|
421
|
-
console.log(error);
|
|
422
|
-
}*/
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
if(ads){
|
|
426
|
-
ads.destroy();
|
|
427
|
-
}
|
|
428
|
-
that.off();
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
//XXX : I hope using es6 classes. but I think to occur problem from Old IE. Then I choice function inherit. Finally using super function is so difficult.
|
|
432
|
-
// use : let super_destroy = that.super('destroy'); ... super_destroy();
|
|
433
|
-
that.super = (name) => {
|
|
434
|
-
const method = that[name];
|
|
435
|
-
return function(){
|
|
436
|
-
return method.apply(that, arguments);
|
|
437
|
-
};
|
|
438
|
-
};
|
|
439
|
-
return that;
|
|
440
|
-
};
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
export default Provider;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by hoho on 2018. 8. 23..
|
|
3
|
-
*/
|
|
4
|
-
import {STATE_IDLE, PROVIDER_RTMP} from "api/constants";
|
|
5
|
-
import Provider from "api/provider/flash/Provider";
|
|
6
|
-
/**
|
|
7
|
-
* @brief rtmp provider
|
|
8
|
-
* @param element video element.
|
|
9
|
-
* @param playerConfig config.
|
|
10
|
-
* */
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const Rtmp = function(element, playerConfig, adTagUrl){
|
|
14
|
-
let that = {};
|
|
15
|
-
let superDestroy_func = null;
|
|
16
|
-
|
|
17
|
-
let spec = {
|
|
18
|
-
name : PROVIDER_RTMP,
|
|
19
|
-
element : element,
|
|
20
|
-
mse : null,
|
|
21
|
-
listener : null,
|
|
22
|
-
isLoaded : false,
|
|
23
|
-
canSeek : false,
|
|
24
|
-
isLive : false,
|
|
25
|
-
seeking : false,
|
|
26
|
-
state : STATE_IDLE,
|
|
27
|
-
buffer : 0,
|
|
28
|
-
framerate : 0,
|
|
29
|
-
currentQuality : -1,
|
|
30
|
-
currentSource : -1,
|
|
31
|
-
qualityLevels : [],
|
|
32
|
-
sources : [],
|
|
33
|
-
adTagUrl : adTagUrl
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
that = Provider(spec, playerConfig, null);
|
|
37
|
-
superDestroy_func = that.super('destroy');
|
|
38
|
-
|
|
39
|
-
OvenPlayerConsole.log("RTMP PROVIDER LOADED.");
|
|
40
|
-
|
|
41
|
-
that.destroy = () =>{
|
|
42
|
-
OvenPlayerConsole.log("RTMP : PROVIDER DESTROYED.");
|
|
43
|
-
superDestroy_func();
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return that;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export default Rtmp;
|