W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
根據(jù)video組件id創(chuàng)建可以控制組件的上下文VideoContext對(duì)象
tt.createVideoContext(id, [component]);
名稱 | 數(shù)據(jù)類型 | 屬性 | 默認(rèn)值 | 描述 |
---|---|---|---|---|
id
|
string
|
required | N/A | ttml中組件的id |
component
|
object
|
optional | N/A | 在自定義組件下,當(dāng)前組件實(shí)例的this,以操作組件內(nèi)video 組件 |
調(diào)用后返回一個(gè)VideoContext對(duì)象,該對(duì)象包含以下方法
播放視頻
暫停視頻
停止視頻
視頻點(diǎn)播,跳轉(zhuǎn)到指定位置position
進(jìn)入全屏, 且方向固定為橫屏
進(jìn)入全屏
<video src="http://sf1-ttcdn-tos.pstatp.com/obj/ttfe/test/test-upload.mp4" rel="external nofollow"
id="myVideo" style="width: 240px; height: 180px;" controls="{{false}}"
/>
<view style="display: flex; justify-content: space-between; align-items: center;">
<button bindtap="play" size="mini">Play</button>
<button bindtap="pause" size="mini">Pause</button>
<button bindtap="stop" size="mini">Stop</button>
</view>
Page({
onReady: function () {
this.videoCtx = tt.createVideoContext('myVideo');
},
play: function () {
this.videoCtx.play();
},
pause: function () {
this.videoCtx.pause()
},
stop: function () {
this.videoCtx.stop()
}
})
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: