Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 214fee1

Browse files
committed
[CHG]默认开启声音,添加开启声音方法
1 parent 718e382 commit 214fee1

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

ezuikit.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -896,23 +896,22 @@
896896
}
897897
} else if (!!this.jSPlugin) {
898898
var _this = this;
899-
function getPlayParams(url) {
899+
// 默认开启第一路声音
900+
setTimeout(function(){
901+
_this.log("默认开启第一路声音")
900902
_this.jSPlugin.JS_OpenSound(0);
901-
// _this.jSPlugin.JS_SetVolume(0,100);
903+
},5000)
904+
function getPlayParams(url) {
902905
var websocketConnectUrl = url.split('?')[0].replace('/live', '').replace('/playback', '');
903906
var websocketStreamingParam = (url.indexOf('/live')=== -1 ? '/playback?': '/live?') + url.split('?')[1];
904907
return { websocketConnectUrl: websocketConnectUrl, websocketStreamingParam: websocketStreamingParam }
905908
}
906909
if (!params || typeof params.index === 'undefined') {
907910
_this.opt.sources.forEach(function (item, index) {
908-
console.log("ready realplay")
909911
_this.jSPlugin.JS_Play(getPlayParams(item).websocketConnectUrl, { playURL: getPlayParams(item).websocketStreamingParam }, index).then(function () {
910912
console.log("realplay success");
911913
if (params && params.handleSuccess) {
912914
params.handleSuccess();
913-
// 默认开启声音
914-
_this.jSPlugin.JS_OpenSound(0);
915-
// _this.jSPlugin.JS_SetVolume(0,100);
916915
}
917916
}, function (err) {
918917
console.log("realplay failed", err.oError);
@@ -1090,6 +1089,7 @@
10901089
}
10911090
}
10921091
};
1092+
// 获取OSD时间
10931093
EZUIPlayer.prototype.getOSDTime = function(callback,iWind){
10941094
if (!!this.jSPlugin){
10951095
this.jSPlugin.JS_GetOSDTime(iWind || 0).then(function(iTime){
@@ -1101,6 +1101,14 @@
11011101
throw new Error("Method not support");
11021102
}
11031103
}
1104+
// 开启声音
1105+
EZUIPlayer.prototype.openSound = function(iWind){
1106+
if (!!this.jSPlugin){
1107+
this.jSPlugin.JS_OpenSound(iWind || 0)
1108+
}else {
1109+
throw new Error("Method not support");
1110+
}
1111+
}
11041112
EZUIPlayer.prototype.pause = function () {
11051113
this.opt.autoplay = false;
11061114
if (!!window['CKobject']) {

0 commit comments

Comments
 (0)