收藏
回答

videoContext.stop();真机测试安卓手机无效

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug videoContext 微信安卓客户端 8.0.2 2.16.1

https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.play.html

 videoContext.seek(0);

videoContext.pause();

videoContext.stop();

真机测试安卓手机无效

回答关注问题邀请回答
收藏

2 个回答

  • 社区技术运营专员--阳光
    社区技术运营专员--阳光
    2021-05-26

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2021-05-26
    有用
    回复
  • 发哥
    发哥
    2021-06-06

    js代码:

     Page({

      data: {

        video:[],

        changeindex:0,

        videoindex:[0,1]

      },

    onLoad: function() {

        var that = this;

        //读取数据库

        wx.request({

          url: 'https://***/video.php',

          method: 'GET',

          data: {

            cpid: 1

          },

          header: {

            'content-Type': 'application/json'

          },

          success(res) {

              that.setData({

                video: res.data,

              });

          }

        })

      },

    slide(e){

      var preindex=[];

      if(e.detail.current==0){

       preindex=[0,1];

      }else if(e.detail.current==this.data.video.length-1){

        preindex=[e.detail.current-1,e.detail.current];

      }else{

        preindex=[e.detail.current-1,e.detail.current,e.detail.current+1];

      }

      let videoid='video'+(this.data.changeindex+1);

      console.log(videoid);

      let videoContext=wx.createVideoContext(videoid,this);

      videoContext.seek(0);

      videoContext.stop();

      videoContext.pause();

      videoid='video'+(e.detail.current+1);

      console.log(videoid);

      videoContext=wx.createVideoContext(videoid,this);

      videoContext.play();

      this.setData({

        changeindex:e.detail.current,

        videoindex:preindex

      })

    },


    WXML代码:

    <view class="video">

      <swiper class="swivideo" vertical="{{true}}" bindchange="slide">

        <swiper-item wx:for="{{video}}" class="" wx:key="index"> 

          <video id="{{item.videoplayid}}" wx:if="{{toolStr.indexOf(videoindex, index) > -1 ? true : false}}" src="{{item.videosrc}}" controls="{{false}}" loop="{{true}}" show-fullscreen-btn="{{false}}" show-play-btn="{{false}}" show-center-play-btn="{{false}}" autoplay="{{index==changeindex}}"></video>

        </swiper-item>

      </swiper>

    </view>

    2021-06-06
    有用
    回复 3
    • 发哥
      发哥
      2021-06-08
      有人知道么
      2021-06-08
      回复
    • 好人ᴢ
      好人ᴢ
      2022-06-10
      提供完就完了。今天几号?哈哈哈哈
      2022-06-10
      回复
    • 风逐浪
      风逐浪
      01-22
      还是有这个问题,官方到现在了还没修复吗,已经快3年了
      01-22
      回复
登录 后发表内容