W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎勵(lì)
解釋: swan.createLivePlayerContext 的返回值
屬性名 | 說明 |
---|---|
LivePlayerContext.play | 播放 |
LivePlayerContext.mute | 靜音 |
LivePlayerContext.pause | 暫停 |
LivePlayerContext.resume | 恢復(fù) |
LivePlayerContext.stop | 停止 |
LivePlayerContext.requestFullScreen | 進(jìn)入全屏 |
LivePlayerContext.exitFullScreen | 退出全屏 |
<live-player id="myLive" src="{{src}}"></live-player>
<button type="primary" bind:tap="livePlay">播放</button>
<button type="primary" bind:tap="livePause">暫停</button>
<button type="primary" bind:tap="liveMute">點(diǎn)擊靜音</button>
<button type="primary" bind:tap="liveResume">恢復(fù)</button>
<button type="primary" bind:tap="liveStop">停止</button>
<button type="primary" bind:tap="requestFullScreen">進(jìn)入全屏</button>
</view>
Page({
data: {
src: 'https://b.bdstatic.com/miniapp/development_tool/Smartprogram.mp4'
},
onReady(e) {
this.livePlayerContext = swan.createLivePlayerContext('myLive');
console.log('這是一個(gè)LivePlayerContext實(shí)例:', this.livePlayerContext);
// 使用此API需要小程序主體開通直播鑒權(quán)
},
livePlay(e) {
this.livePlayerContext.play();
},
livePause(e) {
this.livePlayerContext.pause();
},
liveStop(e) {
this.livePlayerContext.stop();
},
liveMute(e) {
this.livePlayerContext.mute();
},
liveResume(e) {
this.livePlayerContext.resume();
},
requestFullScreen(e) {
this.livePlayerContext.requestFullScreen();
}
});
錯(cuò)誤碼 | 說明 |
---|---|
201 |
解析失敗,請檢查調(diào)起協(xié)議是否合法 |
401 |
安全校驗(yàn)失敗 |
1001 |
執(zhí)行失敗 |
錯(cuò)誤碼 | 說明 |
---|---|
202 |
解析失敗,請檢查參數(shù)是否正確 |
401 |
安全校驗(yàn)失敗 |
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: