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

Skip to content

Commit b6d7e1f

Browse files
committed
[CHG]支持自定义选择解码库引擎版本
1 parent 6e5f3d8 commit b6d7e1f

36 files changed

+7502
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ UIKit JavaScript是用于WEB端,移动H5端的JavaScript插件,使用UIKit J
109109
url | ezopen://open.ys7.com/f01018a141094b7fa138b9d0b856507b.live |null| 直播地址<br>支持ezopen协议格式(推荐)<br>支持ws, wss格式预览地址播放<br>多窗口模式请用英文逗号(,)分隔
110110
accessToken|"at.8o2k6dbpcvtr13reaa96hbnya6fee2wf-9gu6zcjmh2-1j4yrsb-imvlc5poc"|null|用户通过官网或者接口获取的accessToken
111111
decoderPath|解码器相对路径|null|*必填,预览需要本地加载解码器,请填写ezuikit所在相对路径|
112+
decoderVersion|解码器相对路径|null|非必填,默认为最新版本,当前支持的版本 v2.6.4 v3.0 v3.4|
112113
width|400|null|视频元素宽度
113114
height|400|null|视频元素高度
114115
autoplay|true|true|是否自动播放

ezuikit.js

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,14 @@ function addCss(filepath, callback) {
15711571
_this.log("默认开启第1路声音");
15721572
setTimeout(function () {
15731573
var openSoundRT = _this.openSound(0);
1574-
if(openSoundRT == 0) {
1574+
if (isPromise(openSoundRT)) {
1575+
openSoundRT.then(function(){
1576+
_this.log('开启声音成功');
1577+
})
1578+
.catch(function(err){
1579+
_this.log('开启声音失败', 'error');
1580+
})
1581+
}else if(openSoundRT == 0) {
15751582
_this.log('开启声音成功', data)
15761583
}else {
15771584
_this.log('开启声音失败', 'error')
@@ -1673,6 +1680,9 @@ function addCss(filepath, callback) {
16731680
// DOM id
16741681
function initDecoder(resolve, reject) {
16751682
var jsPluginPath = playParams.decoderPath + '/js/jsPlugin-1.2.0.min.js';
1683+
if(playParams.decoderVersion) {
1684+
var jsPluginPath = playParams.decoderPath + '/js/versions/' + playParams.decoderVersion + '/jsPlugin-1.2.0.min.js';
1685+
}
16761686
document.getElementById(playParams.id).style.width = (playParams.width || 600) + 'px';
16771687
document.getElementById(playParams.id).style.height= (playParams.height || 400) + 'px';
16781688
/** 初始化解码器 */
@@ -1687,7 +1697,7 @@ function addCss(filepath, callback) {
16871697
iHeight: playParams.height || 400,
16881698
iMaxSplit: Math.ceil(Math.sqrt(playParams.url.split(",").length)),
16891699
iCurrentSplit: playParams.splitBasis || Math.ceil(Math.sqrt(playParams.url.split(",").length)),
1690-
szBasePath: playParams.decoderPath + '/js',
1700+
szBasePath: playParams.decoderVersion ? ( playParams.decoderPath + '/js/versions/' + playParams.decoderVersion) : (playParams.decoderPath + '/js'),
16911701
oStyle: {
16921702
border: "none",
16931703
background: "#000000"
@@ -1967,7 +1977,17 @@ function addCss(filepath, callback) {
19671977
EZUIPlayer.prototype.openSound = function (iWind) {
19681978
if (!!this.jSPlugin) {
19691979
var openSoundRT = this.jSPlugin.JS_OpenSound(iWind || 0);
1970-
if(openSoundRT === 0 ){
1980+
if (isPromise(openSoundRT)) {
1981+
openSoundRT.then(function(){
1982+
this.log('开启声音成功');
1983+
if(this.playControls){
1984+
this.playControls.setVoiceStatus(1)
1985+
}
1986+
})
1987+
.catch(function(err){
1988+
this.log('开启声音失败', 'error');
1989+
})
1990+
} else if(openSoundRT === 0 ){
19711991
this.log('开启声音成功');
19721992
if(this.playControls){
19731993
this.playControls.setVoiceStatus(1)
@@ -1992,9 +2012,19 @@ function addCss(filepath, callback) {
19922012
EZUIPlayer.prototype.closeSound = function (iWind) {
19932013
if (!!this.jSPlugin) {
19942014
var closeSoundRT = this.jSPlugin.JS_CloseSound(iWind || 0);
1995-
if(closeSoundRT === 0 ) {
1996-
this.log('关闭声音成功')
1997-
if(this.playControls) {
2015+
if (isPromise(closeSoundRT)) {
2016+
closeSoundRT.then(function(){
2017+
this.log('关闭声音成功');
2018+
if(this.playControls){
2019+
this.playControls.setVoiceStatus(0)
2020+
}
2021+
})
2022+
.catch(function(err){
2023+
this.log('关闭声音失败', 'error');
2024+
})
2025+
} else if(closeSoundRT === 0 ){
2026+
this.log('关闭声音成功');
2027+
if(this.playControls){
19982028
this.playControls.setVoiceStatus(0)
19992029
}
20002030
}else {

js/versions/v2.6.4/jsPlugin-1.2.0.min.js

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/versions/v2.6.4/playctrl/AudioRenderer.js

Lines changed: 225 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)