收藏
回答

live-player在 ios 13、15上播放黑屏,ios 14和安卓播放正常,该如何解决?

## 1.代码片段

https://developers.weixin.qq.com/s/G50RPomm7kyb

## 2. rtmp 格式测试情况

## 3. flv格式测试情况

## 4.主要代码

<view class="page-body">
  <view class="page-section">
    <live-player id="player" src="http://3891.liveplay.myqcloud.com/live/3891_user_6b3e1893_0773.flv" mode="live" autoplay bindstatechange="statechange" binderror="error" />
    <view class="btn-area">
      <button bindtap="bindPlay" class="page-body-button" type="primary">播放</button>
      <button bindtap="bindPause" class="page-body-button" type="primary">暂停</button>
      <button bindtap="bindStop" class="page-body-button" type="primary">停止</button>
      <button bindtap="bindResume" class="page-body-button" type="primary">恢复</button>
      <button bindtap="bindMute" class="page-body-button" type="primary">静音</button>
    </view>
  </view>
</view>


Page({
  onReady(res) {
    this.ctx = wx.createLivePlayerContext('player')
  },
  statechange(e) {
    console.log('live-player code:', e.detail.code)
  },
  error(e) {
    console.error('live-player error:', e.detail.errMsg)
  },
  bindPlay() {
    this.ctx.play({
      success: res => {
        console.log(res, 'play success')
      },
      fail: res => {
        console.log(res, 'play fail')
      }
    })
  },
  bindPause() {
    this.ctx.pause({
      success: res => {
        console.log('pause success')
      },
      fail: res => {
        console.log('pause fail')
      }
    })
  },
  bindStop() {
    this.ctx.stop({
      success: res => {
        console.log('stop success')
      },
      fail: res => {
        console.log('stop fail')
      }
    })
  },
  bindResume() {
    this.ctx.resume({
      success: res => {
        console.log('resume success')
      },
      fail: res => {
        console.log('resume fail')
      }
    })
  },
  bindMute() {
    this.ctx.mute({
      success: res => {
        console.log('mute success')
      },
      fail: res => {
        console.log('mute fail')
      }
    })
  }
})
最后一次编辑于  2022-04-09
回答关注问题邀请回答
收藏

1 个回答

  • 官方提醒
    官方提醒
    2022-06-07

    请问一下,暂停播放这些方法有效果吗?我这边调用方法不报错也没反应

    2022-06-07
    有用
    回复
登录 后发表内容