日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)小程序教程:微信小程序API視頻·VideoContext

VideoContext

VideoContext 實例,可通過 wx.createVideoContext 獲取。

VideoContext 通過 id 跟一個 video 組件綁定,操作對應的 video 組件。

方法:

VideoContext.exitFullScreen()

基礎庫 1.4.0 開始支持,低版本需做兼容處理。

退出全屏

VideoContext.exitPictureInPicture(Object object)

退出小窗,該方法可在任意頁面調用

參數(shù)

Object object

屬性 類型 默認值 必填 說明
success function 接口調用成功的回調函數(shù)
fail function 接口調用失敗的回調函數(shù)
complete function 接口調用結束的回調函數(shù)(調用成功、失敗都會執(zhí)行)

VideoContext.hideStatusBar()

基礎庫 2.1.0 開始支持,低版本需做兼容處理。

隱藏狀態(tài)欄,僅在iOS全屏下有效

VideoContext.pause()

暫停視頻

VideoContext.play()

播放視頻

VideoContext.playbackRate(number rate)

基礎庫 1.4.0 開始支持,低版本需做兼容處理。

設置倍速播放

參數(shù)

number rate

倍率,支持 0.5/0.8/1.0/1.25/1.5,2.6.3 起支持 2.0 倍速

VideoContext.requestFullScreen(Object object)

基礎庫 1.4.0 開始支持,低版本需做兼容處理。

進入全屏。若有自定義內容需在全屏時展示,需將內容節(jié)點放置到 video 節(jié)點內。

參數(shù)

Object object

屬性 類型 默認值 必填 說明 最低版本
direction number 設置全屏時視頻的方向,不指定則根據(jù)寬高比自動判斷。 1.7.0

object.direction 的合法值

說明 最低版本
0 正常豎向
90 屏幕逆時針90度
-90 屏幕順時針90度

VideoContext.seek(number position)

跳轉到指定位置

參數(shù)

number position

跳轉到的位置,單位 s

VideoContext.sendDanmu(Object data)

發(fā)送彈幕

參數(shù)

Object data

彈幕內容

屬性 類型 默認值 必填 說明
text string 彈幕文字
color string 彈幕顏色

VideoContext.showStatusBar()

基礎庫 2.1.0 開始支持,低版本需做兼容處理。

顯示狀態(tài)欄,僅在iOS全屏下有效

VideoContext.stop()

基礎庫 1.7.0 開始支持,低版本需做兼容處理。

停止視頻

示例代碼

在開發(fā)者工具中預覽效果


  
  
    
    
  

function getRandomColor () {
  let rgb = []
  for (let i = 0 ; i < 3; ++i) {
    let color = Math.floor(Math.random() * 256).toString(16)
    color = color.length == 1 ? '0' + color : color
    rgb.push(color)
  }
  return '#' + rgb.join('')
}

Page({
  onReady (res) {
    this.videoContext = wx.createVideoContext('myVideo')
  },
  inputValue: '',
  bindInputBlur (e) {
    this.inputValue = e.detail.value
  },
  bindSendDanmu () {
    this.videoContext.sendDanmu({
      text: this.inputValue,
      color: getRandomColor()
    })
  }
})

名稱欄目:創(chuàng)新互聯(lián)小程序教程:微信小程序API視頻·VideoContext
文章路徑:http://www.5511xx.com/article/cdiccjo.html