ovenplayer 0.10.21 → 0.10.22
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/README.md +5 -5
- package/dist/ovenplayer.js +1 -1
- package/dist/ovenplayer.js.map +1 -1
- package/package.json +1 -1
- package/src/js/api/provider/html5/providers/Hls.js +6 -2
- package/src/js/api/provider/html5/providers/WebRTC.js +2 -1
- package/src/js/api/provider/html5/providers/WebRTCLoader.js +91 -8
- package/src/js/view/components/controls/settingPanel/qualityPanel.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ovenplayer",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.22",
|
|
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": {
|
|
@@ -213,7 +213,11 @@ const HlsProvider = function (element, playerConfig, adTagUrl) {
|
|
|
213
213
|
};
|
|
214
214
|
|
|
215
215
|
that.setAutoQuality = (isAuto) => {
|
|
216
|
-
|
|
216
|
+
if (isAuto) {
|
|
217
|
+
hls.currentLevel = -1;
|
|
218
|
+
} else {
|
|
219
|
+
hls.currentLevel = hls.currentLevel;
|
|
220
|
+
}
|
|
217
221
|
};
|
|
218
222
|
|
|
219
223
|
superStop_func = that.super('stop');
|
|
@@ -248,7 +252,7 @@ const HlsProvider = function (element, playerConfig, adTagUrl) {
|
|
|
248
252
|
}
|
|
249
253
|
|
|
250
254
|
hls = null;
|
|
251
|
-
OvenPlayerConsole.log("HLS : PROVIDER
|
|
255
|
+
OvenPlayerConsole.log("HLS : PROVIDER DESTROYED.");
|
|
252
256
|
superDestroy_func();
|
|
253
257
|
};
|
|
254
258
|
|
|
@@ -10,8 +10,10 @@ import {
|
|
|
10
10
|
PLAYER_WEBRTC_NETWORK_SLOW,
|
|
11
11
|
PLAYER_WEBRTC_UNEXPECTED_DISCONNECT,
|
|
12
12
|
PLAYER_WEBRTC_INTERNAL_ERROR,
|
|
13
|
-
OME_P2P_MODE
|
|
13
|
+
OME_P2P_MODE,
|
|
14
|
+
CONTENT_LEVEL_CHANGED
|
|
14
15
|
} from "api/constants";
|
|
16
|
+
import sizeHumanizer from "../../../../utils/sizeHumanizer";
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
const WebRTCLoader = function (provider,
|
|
@@ -20,7 +22,8 @@ const WebRTCLoader = function (provider,
|
|
|
20
22
|
connectedCallback,
|
|
21
23
|
internalErrorCallback,
|
|
22
24
|
errorTrigger,
|
|
23
|
-
playerConfig
|
|
25
|
+
playerConfig,
|
|
26
|
+
spec) {
|
|
24
27
|
|
|
25
28
|
let defaultConnectionConfig = {};
|
|
26
29
|
|
|
@@ -42,6 +45,9 @@ const WebRTCLoader = function (provider,
|
|
|
42
45
|
|
|
43
46
|
let recoverPacketLoss = false;
|
|
44
47
|
|
|
48
|
+
let playlistFromOme = null;
|
|
49
|
+
let autoQuality = false;
|
|
50
|
+
|
|
45
51
|
if (playerConfig.getConfig().webrtcConfig &&
|
|
46
52
|
playerConfig.getConfig().webrtcConfig.recoverPacketLoss === true) {
|
|
47
53
|
|
|
@@ -665,12 +671,6 @@ const WebRTCLoader = function (provider,
|
|
|
665
671
|
return;
|
|
666
672
|
}
|
|
667
673
|
|
|
668
|
-
if (!message.id) {
|
|
669
|
-
|
|
670
|
-
OvenPlayerConsole.log('ID must be not null');
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
674
|
if (message.command === 'offer') {
|
|
675
675
|
|
|
676
676
|
let iceServers = message.iceServers || message.ice_servers;
|
|
@@ -719,6 +719,57 @@ const WebRTCLoader = function (provider,
|
|
|
719
719
|
addIceCandidate(peerConnection3, message.candidates);
|
|
720
720
|
}
|
|
721
721
|
|
|
722
|
+
if (message.command === 'notification') {
|
|
723
|
+
|
|
724
|
+
if (message.type === 'playlist') {
|
|
725
|
+
|
|
726
|
+
const renditions = message.message.renditions;
|
|
727
|
+
playlistFromOme = message.message;
|
|
728
|
+
|
|
729
|
+
for (let i = 0; i < renditions.length; i++) {
|
|
730
|
+
|
|
731
|
+
let rendition = renditions[i];
|
|
732
|
+
|
|
733
|
+
spec.qualityLevels.push({
|
|
734
|
+
bitrate: rendition.video_track.video.bitrate,
|
|
735
|
+
height: rendition.video_track.video.height,
|
|
736
|
+
width: rendition.video_track.video.width,
|
|
737
|
+
index: i,
|
|
738
|
+
label: rendition.name
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
spec.currentQuality = 0;
|
|
743
|
+
autoQuality = message.message.auto;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
if (message.type === 'rendition_changed') {
|
|
747
|
+
|
|
748
|
+
const rendition = message.message;
|
|
749
|
+
|
|
750
|
+
if (message.auto) {
|
|
751
|
+
autoQuality = message.auto;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
let qualityIndex = -1;
|
|
755
|
+
|
|
756
|
+
for (let i = 0; i < playlistFromOme.renditions.length; i ++) {
|
|
757
|
+
|
|
758
|
+
if (rendition.rendition_name === playlistFromOme.renditions[i].name) {
|
|
759
|
+
qualityIndex = i;
|
|
760
|
+
spec.currentQuality = i;
|
|
761
|
+
break;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
provider.trigger(CONTENT_LEVEL_CHANGED, {
|
|
766
|
+
isAuto: autoQuality,
|
|
767
|
+
currentQuality: qualityIndex,
|
|
768
|
+
type: "render"
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
722
773
|
if (message.command === 'stop') {
|
|
723
774
|
|
|
724
775
|
if (mainPeerConnectionInfo.peerId === message.peer_id) {
|
|
@@ -885,6 +936,38 @@ const WebRTCLoader = function (provider,
|
|
|
885
936
|
|
|
886
937
|
}
|
|
887
938
|
|
|
939
|
+
provider.setCurrentQuality = (qualityIndex) => {
|
|
940
|
+
|
|
941
|
+
let rendition = playlistFromOme.renditions[qualityIndex];
|
|
942
|
+
|
|
943
|
+
sendMessage(ws, {
|
|
944
|
+
command: 'change_rendition',
|
|
945
|
+
id: mainPeerConnectionInfo.id,
|
|
946
|
+
rendition_name: rendition.name,
|
|
947
|
+
auto: false
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
autoQuality = false;
|
|
951
|
+
|
|
952
|
+
spec.currentQuality = qualityIndex;
|
|
953
|
+
return spec.currentQuality;
|
|
954
|
+
};
|
|
955
|
+
|
|
956
|
+
provider.isAutoQuality = () => {
|
|
957
|
+
|
|
958
|
+
return autoQuality;
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
provider.setAutoQuality = (auto) => {
|
|
962
|
+
|
|
963
|
+
sendMessage(ws, {
|
|
964
|
+
command: 'change_rendition',
|
|
965
|
+
id: mainPeerConnectionInfo.id,
|
|
966
|
+
auto: auto
|
|
967
|
+
});
|
|
968
|
+
autoQuality = auto;
|
|
969
|
+
};
|
|
970
|
+
|
|
888
971
|
that.connect = () => {
|
|
889
972
|
|
|
890
973
|
initialize();
|
|
@@ -49,7 +49,7 @@ const QualityPanel = function($container, api, data){
|
|
|
49
49
|
event.preventDefault();
|
|
50
50
|
let value = LA$(event.currentTarget).attr("op-data-value");
|
|
51
51
|
if(value === "AUTO"){
|
|
52
|
-
api.setAutoQuality(
|
|
52
|
+
api.setAutoQuality(!api.isAutoQuality());
|
|
53
53
|
}else{
|
|
54
54
|
api.setCurrentQuality(parseInt(value));
|
|
55
55
|
}
|