字節(jié)跳動(dòng)小程序開發(fā)組件文檔 video

2019-08-12 15:53 更新

視頻組件。

屬性名 類型 默認(rèn)值 說明 最低版本
src String 要播放的視頻資源地址 1.0.0
autoplay Boolean false 是否自動(dòng)播放 1.0.0
poster String 封面圖地址,網(wǎng)絡(luò)地址 1.0.0
bindplay String play事件的handler 1.0.0
bindpause String pause事件的handler 1.0.0
bindended String ended事件的handler 1.0.0
binderror String error事件的handler 1.0.0
bindtimeupdate String timeupdate事件的handler 1.18.0
bindfullscreenchange String fullscreenchange事件的handler 1.18.0
WARNING
video不支持在scroll-view、swiper組件中使用,也不支持在有滾動(dòng)條的容器中使用,不支持fixed

示例


開發(fā)者工具中預(yù)覽

<video src="http://sf1-ttcdn-tos.pstatp.com/obj/ttfe/test/test-upload.mp4" rel="external nofollow" 
    autoplay
    bindplay="play"
    bindpause="pause"
    bindended="ended"
    bindtimeupdate="timeupdate"
    bindfullscreenchange="fullscreenchange"
 />

Page({
  play: function (e) {
    tt.showToast({title: 'play'})
  },
  pause: function (e) {
    tt.showToast({title: 'pause'})
  },
  ended: function (e) {
    tt.showToast({title: 'ended'})
  },
  timeupdate: function (e) {
    console.log(e)
  },
  fullscreenchange: function (e) {
    console.log(e)
  },
})
相關(guān)api: tt.createVideoContext


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)