ovenplayer 0.10.2 → 0.10.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ovenplayer",
3
- "version": "0.10.2",
3
+ "version": "0.10.6",
4
4
  "description": "OvenPlayer is Open-Source HTML5 Player. OvenPlayer supports WebRTC Signaling from OvenMediaEngine for Sub-Second Latency Streaming.",
5
5
  "main": "dist/ovenplayer.js",
6
6
  "scripts": {
package/src/js/api/Api.js CHANGED
@@ -2,16 +2,16 @@ import OvenPlayerSDK from "ovenplayer.sdk"
2
2
  import CaptionManager from "api/caption/Manager";
3
3
  import Configurator from "api/Configurator";
4
4
  import EventEmitter from "api/EventEmitter";
5
- import LazyCommandExecutor from "api/LazyCommandExecutor";
6
5
  import MediaManager from "api/media/Manager";
7
6
  import PlaylistManager from "api/playlist/Manager";
8
7
  import ProviderController from "api/provider/Controller";
9
8
  import {READY, ERRORS, ERROR, CONTENT_COMPLETE, CONTENT_META, INIT_UNKNWON_ERROR, INIT_UNSUPPORT_ERROR, DESTROY, PLAYER_PLAY, NETWORK_UNSTABLED, PLAYER_WEBRTC_NETWORK_SLOW, PLAYER_WEBRTC_UNEXPECTED_DISCONNECT, PLAYER_WEBRTC_SET_LOCAL_DESC_ERROR,
10
9
  PLAYER_FILE_ERROR, PROVIDER_DASH, PROVIDER_HLS, PROVIDER_WEBRTC, PROVIDER_HTML5, PROVIDER_RTMP, ALL_PLAYLIST_ENDED} from "api/constants";
11
- import {version} from 'version';
10
+
12
11
  import {ApiRtmpExpansion} from 'api/ApiExpansions';
13
12
  import {analUserAgent} from "utils/browser";
14
13
  import {pickCurrentSource} from "api/provider/utils";
14
+ import {version} from "../version";
15
15
 
16
16
  /**
17
17
  * @brief This object connects UI to the provider.
@@ -23,7 +23,6 @@ const Api = function(container){
23
23
  const that = {};
24
24
  EventEmitter(that);
25
25
 
26
- console.log("[OvenPlayer] v."+ version);
27
26
  OvenPlayerConsole.log("API loaded.");
28
27
 
29
28
  let playlistManager = PlaylistManager(that);
@@ -32,11 +31,8 @@ const Api = function(container){
32
31
  let mediaManager = MediaManager(container, userAgentObject);
33
32
  let currentProvider = "";
34
33
  let playerConfig = "";
35
- let lazyQueue = "";
36
34
  let captionManager = "";
37
35
 
38
- let webrtcRetryInterval = 1000;
39
-
40
36
  const runNextPlaylist = function(index){
41
37
  OvenPlayerConsole.log("runNextPlaylist");
42
38
  let nextPlaylistIndex = index; // || playlistManager.getCurrentPlaylistIndex() + 1;
@@ -49,8 +45,7 @@ const Api = function(container){
49
45
  playerConfig.setVolume(currentProvider.getVolume());
50
46
 
51
47
  if(hasNextPlaylist){
52
- //that.pause();
53
- lazyQueue = LazyCommandExecutor(that, ['play','seek','stop']);
48
+
54
49
  playlistManager.setCurrentPlaylist(nextPlaylistIndex);
55
50
  initProvider();
56
51
 
@@ -103,18 +98,18 @@ const Api = function(container){
103
98
 
104
99
  // Chrome >=80 on Android misses h246 in SDP when first time after web page loaded.
105
100
  // So wait until browser get h264 capabilities and create answer SDP.
106
- if (userAgentObject.os === 'Android' && userAgentObject.browser === 'Chrome') {
107
-
108
- if (data && data.code && data.code === PLAYER_WEBRTC_SET_LOCAL_DESC_ERROR) {
109
-
110
- setTimeout(function () {
111
-
112
- that.setCurrentSource(that.getCurrentSource());
113
- }, webrtcRetryInterval);
114
-
115
- return;
116
- }
117
- }
101
+ // if (userAgentObject.os === 'Android' && userAgentObject.browser === 'Chrome') {
102
+ //
103
+ // if (data && data.code && data.code === PLAYER_WEBRTC_SET_LOCAL_DESC_ERROR) {
104
+ //
105
+ // setTimeout(function () {
106
+ //
107
+ // that.setCurrentSource(that.getCurrentSource());
108
+ // }, webrtcRetryInterval);
109
+ //
110
+ // return;
111
+ // }
112
+ // }
118
113
 
119
114
  if (playerConfig.getConfig().autoFallback && that.getCurrentSource() + 1 < that.getSources().length) {
120
115
 
@@ -143,12 +138,9 @@ const Api = function(container){
143
138
  //provider's preload() have to made Promise. Cuz it overcomes 'flash loading timing problem'.
144
139
  currentProvider.preload(playlistManager.getCurrentSources(), lastPlayPosition).then(function(){
145
140
 
146
- lazyQueue.flush();
147
- //This is no reason to exist anymore.
148
- lazyQueue.destroy();
149
141
 
150
142
  }).catch((error) => {
151
- lazyQueue.off();
143
+
152
144
  if(error && error.code && ERRORS.codes[error.code]){
153
145
  that.trigger(ERROR, ERRORS.codes[error.code]);
154
146
  }else {
@@ -166,13 +158,6 @@ const Api = function(container){
166
158
  tempError.error = error;
167
159
  that.trigger(ERROR, tempError);
168
160
  }
169
-
170
- //xxx : If you init empty sources. (I think this is strange case.)
171
- //This works for this case.
172
- //player = OvenPlayer.create("elId", {});
173
- //player.load(soruces);
174
- lazyQueue.off();
175
- //lazyQueue.removeAndExcuteOnce("load");
176
161
  });
177
162
  };
178
163
 
@@ -188,11 +173,6 @@ const Api = function(container){
188
173
  options = {};
189
174
  }
190
175
 
191
- //It collects the commands and executes them at the time when they are executable.
192
- lazyQueue = LazyCommandExecutor(that, [
193
- 'load','play','pause','seek','stop', 'getDuration', 'getPosition', 'getVolume'
194
- , 'getMute', 'getBuffer', 'getState' , 'getQualityLevels'
195
- ]);
196
176
  options.mediaContainer = container;
197
177
  options.browser = userAgentObject;
198
178
  playerConfig = Configurator(options, that);
@@ -296,7 +276,6 @@ const Api = function(container){
296
276
  };
297
277
  that.load = (playlist) => {
298
278
  OvenPlayerConsole.log("API : load() ", playlist);
299
- lazyQueue = LazyCommandExecutor(that, ['play','seek','stop']);
300
279
 
301
280
  if(playlist){
302
281
 
@@ -387,23 +366,8 @@ const Api = function(container){
387
366
 
388
367
  OvenPlayerConsole.log("API : setCurrentSource() ", index);
389
368
 
390
- // let sources = currentProvider.getSources();
391
- // let currentSource = sources[currentProvider.getCurrentSource()];
392
- // let newSource = sources[index];
393
-
394
- // let isSameProvider = providerController.isSameProvider(currentSource, newSource);
395
- // // provider.serCurrentQuality -> playerConfig setting -> load
396
- // let resultSourceIndex = currentProvider.setCurrentSource(index, isSameProvider);
397
- //
398
- // if(!newSource){
399
- // return null;
400
- // }
401
- //
402
- // OvenPlayerConsole.log("API : setCurrentQuality() isSameProvider", isSameProvider);
403
-
404
369
  let lastPlayPosition = currentProvider.getPosition();
405
370
  playerConfig.setSourceIndex(index);
406
- lazyQueue = LazyCommandExecutor(that, ['play','seek']);
407
371
 
408
372
  initProvider(lastPlayPosition);
409
373
 
@@ -490,10 +454,6 @@ const Api = function(container){
490
454
 
491
455
  OvenPlayerConsole.log("API : remove() ");
492
456
 
493
- if (lazyQueue) {
494
- lazyQueue.destroy();
495
- }
496
-
497
457
  if(captionManager){
498
458
  captionManager.destroy();
499
459
  captionManager = null;
@@ -515,9 +475,8 @@ const Api = function(container){
515
475
  providerController = null;
516
476
  playlistManager = null;
517
477
  playerConfig = null;
518
- lazyQueue = null;
519
478
 
520
- OvenPlayerConsole.log("API : remove() - lazyQueue, currentProvider, providerController, playlistManager, playerConfig, api event destroed. ");
479
+ OvenPlayerConsole.log("API : remove() - currentProvider, providerController, playlistManager, playerConfig, api event destroed. ");
521
480
  OvenPlayerSDK.removePlayer(that.getContainerId());
522
481
  if(OvenPlayerSDK.getPlayerList().length === 0){
523
482
  OvenPlayerConsole.log("OvenPlayerSDK.playerList", OvenPlayerSDK.getPlayerList());
@@ -525,7 +484,7 @@ const Api = function(container){
525
484
  };
526
485
 
527
486
  that.getVersion = () => {
528
- return "v."+version;
487
+ return version;
529
488
  };
530
489
 
531
490
  return that;
@@ -203,7 +203,9 @@ const Configurator = function(options, provider){
203
203
  that.getRtmpBufferTimeMax = () => {
204
204
  return spec.rtmpBufferTimeMax;
205
205
  };
206
-
206
+ that.setMute = (mute) =>{
207
+ spec.mute = mute;
208
+ };
207
209
  that.isMute = () =>{
208
210
  return spec.mute;
209
211
  };
@@ -218,12 +218,11 @@ const Provider = function (spec, playerConfig, onExtendedLoad){
218
218
  return false;
219
219
  }
220
220
  elVideo.volume = volume/100;
221
+ playerConfig.setVolume(volume);
221
222
  };
222
223
  that.getVolume = () =>{
223
- if(!elVideo){
224
- return 0;
225
- }
226
- return elVideo.volume*100;
224
+
225
+ return playerConfig.getVolume();
227
226
  };
228
227
  that.setMute = (state) =>{
229
228
  if(!elVideo){
@@ -231,27 +230,29 @@ const Provider = function (spec, playerConfig, onExtendedLoad){
231
230
  }
232
231
  if (typeof state === 'undefined') {
233
232
 
234
- elVideo.muted = !elVideo.muted;
233
+ const muted = playerConfig.isMute();
234
+
235
+ elVideo.muted = !muted;
236
+ playerConfig.setMute(!muted);
235
237
 
236
238
  that.trigger(CONTENT_MUTE, {
237
- mute: elVideo.muted
239
+ mute: playerConfig.isMute()
238
240
  });
239
241
 
240
242
  } else {
241
243
 
242
244
  elVideo.muted = state;
245
+ playerConfig.setMute(state);
243
246
 
244
247
  that.trigger(CONTENT_MUTE, {
245
- mute: elVideo.muted
248
+ mute: playerConfig.isMute()
246
249
  });
247
250
  }
248
251
  return elVideo.muted;
249
252
  };
250
253
  that.getMute = () =>{
251
- if(!elVideo){
252
- return false;
253
- }
254
- return elVideo.muted;
254
+
255
+ return playerConfig.isMute();
255
256
  };
256
257
 
257
258
  that.preload = (sources, lastPlayPosition) =>{
@@ -43,40 +43,26 @@ const Dash = function (element, playerConfig, adTagUrl) {
43
43
 
44
44
  try {
45
45
 
46
- if (dashjs.Version < "2.6.5") {
46
+ if (dashjs.Version < "3.0.0") {
47
47
  throw ERRORS.codes[INIT_DASH_UNSUPPORT];
48
48
  }
49
49
 
50
50
  const coveredSetAutoSwitchQualityFor = function (isAuto) {
51
51
 
52
- if (dashjs.Version >= '3.0.0') {
53
- dash.updateSettings({
54
- streaming: {
55
- abr: {
56
- autoSwitchBitrate: {
57
- video: isAuto
58
- }
52
+ dash.updateSettings({
53
+ streaming: {
54
+ abr: {
55
+ autoSwitchBitrate: {
56
+ video: isAuto
59
57
  }
60
58
  }
61
- });
62
- } else if (dashjs.Version > "2.9.0") {
63
- dash.setAutoSwitchQualityFor("video", isAuto);
64
- } else {
65
- dash.setAutoSwitchQualityFor(isAuto);
66
- }
59
+ }
60
+ });
67
61
  };
68
62
 
69
63
  const coveredGetAutoSwitchQualityFor = function () {
70
- let result = "";
71
64
 
72
- if (dashjs.Version >= '3.0.0') {
73
- result = dash.getSettings().streaming.abr.autoSwitchBitrate.video;
74
- } else if (dashjs.Version > "2.9.0") {
75
- result = dash.getAutoSwitchQualityFor("video");
76
- } else {
77
- result = dash.getAutoSwitchQualityFor();
78
- }
79
- return result;
65
+ return dash.getSettings().streaming.abr.autoSwitchBitrate.video;
80
66
  };
81
67
 
82
68
  const liveDelayReducingCallback = function () {
@@ -124,122 +110,71 @@ const Dash = function (element, playerConfig, adTagUrl) {
124
110
 
125
111
  OvenPlayerConsole.log("DASH : Attach File : ", source, "lastPlayPosition : " + lastPlayPosition);
126
112
 
127
- that.trigger(DASH_PREPARED, dash);
128
-
129
113
  coveredSetAutoSwitchQualityFor(true);
130
114
  sourceOfFile = source.file;
131
115
 
132
- dash.off(dashjs.MediaPlayer.events.PLAYBACK_PLAYING, liveDelayReducingCallback);
116
+ // dash.off(dashjs.MediaPlayer.events.PLAYBACK_PLAYING, liveDelayReducingCallback);
133
117
 
134
118
  if (source.lowLatency === true) {
135
119
 
136
120
  prevLLLiveDuration = null;
137
121
 
138
- if (dashjs.Version >= '3.0.0') {
139
-
140
- dash.updateSettings({
141
- streaming: {
142
- lowLatencyEnabled: source.lowLatency
143
- }
144
- });
145
-
146
- } else {
147
-
148
- dash.setLowLatencyEnabled(source.lowLatency);
149
- }
150
-
151
- if (playerConfig.getConfig().lowLatencyMpdLiveDelay && typeof(playerConfig.getConfig().lowLatencyMpdLiveDelay) === 'number') {
152
-
153
- if (dashjs.Version >= '3.0.0') {
154
-
155
- dash.updateSettings({
156
- streaming: {
157
- liveDelay: playerConfig.getConfig().lowLatencyMpdLiveDelay
158
- }
159
- });
160
- } else {
161
- dash.setLiveDelay(playerConfig.getConfig().lowLatencyMpdLiveDelay);
122
+ dash.updateSettings({
123
+ streaming: {
124
+ lowLatencyEnabled: source.lowLatency
162
125
  }
163
- }
164
-
165
- dash.on(dashjs.MediaPlayer.events.PLAYBACK_PLAYING, liveDelayReducingCallback);
166
-
167
- } else {
126
+ });
168
127
 
169
- if (dashjs.Version >= '3.0.0') {
128
+ if (playerConfig.getConfig().lowLatencyMpdLiveDelay && typeof(playerConfig.getConfig().lowLatencyMpdLiveDelay) === 'number') {
170
129
 
171
130
  dash.updateSettings({
172
131
  streaming: {
173
- lowLatencyEnabled: false,
174
- liveDelay: undefined
132
+ liveDelay: playerConfig.getConfig().lowLatencyMpdLiveDelay
175
133
  }
176
134
  });
177
-
178
- } else {
179
-
180
- dash.setLowLatencyEnabled(false);
181
- dash.setLiveDelay();
182
135
  }
183
136
 
184
- }
137
+ // dash.on(dashjs.MediaPlayer.events.PLAYBACK_PLAYING, liveDelayReducingCallback);
185
138
 
186
- if (dashjs.Version >= '3.0.0') {
139
+ } else {
187
140
 
188
141
  dash.updateSettings({
189
- debug: {
190
- logLevel: dashjs.Debug.LOG_LEVEL_NONE
142
+ streaming: {
143
+ lowLatencyEnabled: false,
144
+ liveDelay: undefined
191
145
  }
192
146
  });
193
147
 
194
- } else {
148
+ }
149
+
150
+ dash.updateSettings({
151
+ debug: {
152
+ logLevel: dashjs.Debug.LOG_LEVEL_NONE
153
+ }
154
+ });
155
+
156
+ let dashConfigFromPlayerConfig = playerConfig.getConfig().dashConfig;
195
157
 
196
- dash.getDebug().setLogToBrowserConsole(false);
158
+ if (dashConfigFromPlayerConfig) {
159
+ dash.updateSettings(dashConfigFromPlayerConfig);
197
160
  }
198
161
 
162
+ that.trigger(DASH_PREPARED, dash);
163
+
199
164
  dash.attachSource(sourceOfFile);
200
165
 
201
166
  seekPosition_sec = lastPlayPosition;
202
-
203
167
  });
204
168
 
205
169
  superPlay_func = that.super('play');
206
170
  superDestroy_func = that.super('destroy');
207
171
  OvenPlayerConsole.log("DASH PROVIDER LOADED.");
208
172
 
209
- let loadingRetryCount = playerConfig.getConfig().loadingRetryCount;
210
-
211
173
  dash.on(dashjs.MediaPlayer.events.ERROR, function (error) {
212
174
 
213
- // Handle mpd load error.
214
- if (error &&
215
- (
216
- error.error.code === dashjs.MediaPlayer.errors.DOWNLOAD_ERROR_ID_MANIFEST_CODE ||
217
- error.error.code === dashjs.MediaPlayer.errors.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE
218
- )) {
219
-
220
- if (loadingRetryCount > 0) {
221
-
222
- that.setState(STATE_LOADING);
223
-
224
- if (loadRetryer) {
225
- clearTimeout(loadRetryer);
226
- loadRetryer = null;
227
- }
228
-
229
- loadingRetryCount = loadingRetryCount - 1;
230
-
231
- loadRetryer = setTimeout(function () {
232
-
233
-
234
- dash.attachSource(sourceOfFile);
235
- }, 1000);
236
- } else {
237
-
238
- let tempError = ERRORS.codes[PLAYER_UNKNWON_NETWORK_ERROR];
239
- tempError.error = error;
240
- errorTrigger(tempError, that);
241
- }
242
- }
175
+ let tempError = ERRORS.codes[PLAYER_UNKNWON_NETWORK_ERROR];
176
+ tempError.error = error;
177
+ errorTrigger(tempError, that);
243
178
  });
244
179
 
245
180
  dash.on(dashjs.MediaPlayer.events.QUALITY_CHANGE_REQUESTED, function (event) {
@@ -288,12 +223,6 @@ const Dash = function (element, playerConfig, adTagUrl) {
288
223
  dash.seek(seekPosition_sec);
289
224
  }
290
225
 
291
- // if (playerConfig.isAutoStart() && !runedAutoStart) {
292
- // OvenPlayerConsole.log("DASH : AUTOPLAY()!");
293
- // that.play();
294
- // runedAutoStart = true;
295
- // }
296
-
297
226
  });
298
227
 
299
228
  that.play = (mutedPlay) => {
@@ -82,8 +82,6 @@ const HlsProvider = function (element, playerConfig, adTagUrl) {
82
82
 
83
83
  OvenPlayerConsole.log("HLS : onExtendedLoad : ", source, "lastPlayPosition : " + lastPlayPosition);
84
84
 
85
- let loadingRetryCount = playerConfig.getConfig().loadingRetryCount;
86
-
87
85
  hls.loadSource(source.file);
88
86
 
89
87
  hls.once(Hls.Events.MANIFEST_LOADED, function (event, data) {
@@ -132,89 +130,27 @@ const HlsProvider = function (element, playerConfig, adTagUrl) {
132
130
 
133
131
  }, 1000);
134
132
 
135
- } else {
136
-
137
- hls.once(Hls.Events.FRAG_LOADING, function () {
138
- that.setState(STATE_LOADING);
139
- });
140
-
141
- if (data.type === Hls.ErrorTypes.MEDIA_ERROR) {
142
-
143
- if (!data.fatal) {
144
- // do nothing when non fatal media error. hlsjs will recover it automatically.
145
- return;
146
- }
147
- }
148
-
149
- if (loadingRetryCount > 0) {
150
-
151
- that.setState(STATE_LOADING);
152
-
153
- if (loadRetryer) {
154
- clearTimeout(loadRetryer);
155
- loadRetryer = null;
156
- }
157
-
158
- loadingRetryCount = loadingRetryCount - 1;
159
-
160
- if (data.type === Hls.ErrorTypes.NETWORK_ERROR) {
161
-
162
- loadRetryer = setTimeout(function () {
163
-
164
- that.stop();
165
-
166
- if (hls) {
167
-
168
- hls.stopLoad();
169
- hls.startLoad();
170
- }
171
-
172
- that.play();
173
- }, 1000);
174
- } else if (data.type === Hls.ErrorTypes.MEDIA_ERROR) {
175
-
176
- loadRetryer = setTimeout(function () {
177
-
178
- if (hls) {
179
-
180
- hls.recoverMediaError();
181
- }
182
-
183
- that.play();
184
- }, 1000);
185
- } else {
186
-
187
- loadRetryer = setTimeout(function () {
188
-
189
- that.stop();
190
-
191
- if (hls) {
192
-
193
- hls.stopLoad();
194
- hls.startLoad();
195
- }
196
-
197
- that.play();
198
- }, 1000);
199
- }
200
-
201
- } else {
133
+ return;
134
+ }
202
135
 
203
- let errorType = PLAYER_UNKNWON_NETWORK_ERROR;
136
+ if (!data.fatal) {
137
+ // do nothing when non fatal error. hlsjs will recover it automatically.
138
+ return;
139
+ }
204
140
 
205
- if (data && data.networkDetails && data.networkDetails.status === 400) {
206
- errorType = PLAYER_BAD_REQUEST_ERROR;
207
- } else if (data && data.networkDetails && data.networkDetails.status === 403) {
208
- errorType = PLAYER_AUTH_FAILED_ERROR;
209
- } else if (data && data.networkDetails && data.networkDetails.status === 406) {
210
- errorType = PLAYER_NOT_ACCEPTABLE_ERROR;
211
- }
141
+ let errorType = PLAYER_UNKNWON_NETWORK_ERROR;
212
142
 
213
- let tempError = ERRORS.codes[errorType];
214
- tempError.error = data.details;
215
- errorTrigger(tempError, that);
216
- }
143
+ if (data && data.networkDetails && data.networkDetails.status === 400) {
144
+ errorType = PLAYER_BAD_REQUEST_ERROR;
145
+ } else if (data && data.networkDetails && data.networkDetails.status === 403) {
146
+ errorType = PLAYER_AUTH_FAILED_ERROR;
147
+ } else if (data && data.networkDetails && data.networkDetails.status === 406) {
148
+ errorType = PLAYER_NOT_ACCEPTABLE_ERROR;
217
149
  }
150
+
151
+ let tempError = ERRORS.codes[errorType];
152
+ tempError.error = data.details;
153
+ errorTrigger(tempError, that);
218
154
  });
219
155
 
220
156
  that.on(PLAYER_STATE, function (data) {
@@ -52,6 +52,9 @@ const WebRTC = function(element, playerConfig, adTagUrl){
52
52
  }
53
53
 
54
54
  element.srcObject = stream;
55
+
56
+ const AudioContext = window.AudioContext || window.webkitAudioContext;
57
+ audioCtx = new AudioContext();
55
58
  };
56
59
 
57
60
  webrtcLoader = WebRTCLoader(that, source.file, loadCallback, errorTrigger, playerConfig);
@@ -276,7 +276,7 @@ const WebRTCLoader = function (provider, webSocketUrl, loadCallback, errorTrigge
276
276
  }
277
277
  }
278
278
 
279
- regIceServer.username = iceServer.user_name;
279
+ regIceServer.username = iceServer.username || iceServer.user_name;
280
280
  regIceServer.credential = iceServer.credential;
281
281
 
282
282
  peerConnectionConfig.iceServers.push(regIceServer);
@@ -649,7 +649,9 @@ const WebRTCLoader = function (provider, webSocketUrl, loadCallback, errorTrigge
649
649
 
650
650
  if (message.command === 'offer') {
651
651
 
652
- createMainPeerConnection(message.id, message.peer_id, message.sdp, message.candidates, message.ice_servers, resolve);
652
+ let iceServers = message.iceServers || message.ice_servers;
653
+
654
+ createMainPeerConnection(message.id, message.peer_id, message.sdp, message.candidates, iceServers, resolve);
653
655
  if (message.peer_id === 0) {
654
656
  provider.trigger(OME_P2P_MODE, false);
655
657
  } else {
@@ -1,5 +1,6 @@
1
+ import {version} from 'version'
1
2
  import OvenPlayerSDK from './ovenplayer.sdk'
2
- import {checkAndGetContainerElement} from 'utils/validator';
3
+ import {checkAndGetContainerElement} from 'utils/validator'
3
4
  import View from './view/view';
4
5
 
5
6
  function ovenPlayerFactory() {
@@ -10,6 +11,8 @@ function ovenPlayerFactory() {
10
11
 
11
12
  OvenPlayer.create = function (container, options) {
12
13
 
14
+ console.log("[OvenPlayer] v."+ version);
15
+
13
16
  let containerElement = checkAndGetContainerElement(container);
14
17
 
15
18
  let player = View(containerElement);
@@ -96,9 +96,6 @@ const VolumeButton = function($container, api){
96
96
  api.on(READY, function() {
97
97
  setVolumeUI(api.getVolume());
98
98
  }, template);
99
- api.on(PLAYER_PLAY, function (data) {
100
- setVolumeUI(data.volume);
101
- }, template);
102
99
  api.on(CONTENT_VOLUME, function(data) {
103
100
 
104
101
  setVolumeUI(data.volume);
@@ -313,9 +313,14 @@ const View = function($container){
313
313
 
314
314
  api.on(READY, function(data) {
315
315
 
316
- if(!controls && showControlBar){
316
+ if(!controls){
317
317
  controls = Controls($playerRoot.find(".op-ui"), playerInstance);
318
318
  }
319
+
320
+ if (!showControlBar) {
321
+ $playerRoot.addClass("op-no-controls");
322
+ }
323
+
319
324
  });
320
325
 
321
326
  api.on(ERROR, function(error) {
@@ -378,6 +383,15 @@ const View = function($container){
378
383
  $playerRoot.find('.op-ratio').css('padding-bottom', ratio + '%');
379
384
  }
380
385
  }
386
+
387
+ api.showControls = function (show) {
388
+ if (show) {
389
+ $playerRoot.removeClass("op-no-controls");
390
+ setHide(false, true);
391
+ } else {
392
+ $playerRoot.addClass("op-no-controls");
393
+ }
394
+ };
381
395
  };
382
396
 
383
397