收藏
回答

live-player全屏显示不全 什么机型都是这样 为什么?

调用enterFullscreen后 全屏展示不全只展示中间部分 并且还出现纵向滚动问题
enterFullscreen(params) {
      console.log(TAG_NAME, 'enterFullscreen', params)
      return new Promise((resolve, reject) => {
        this.userController.getStream(params).playerContext.requestFullScreen({
          direction: params.direction || 0,
          success: (event) => {
            console.log(TAG_NAME, 'enterFullscreen success', event)
            resolve(event)
          },
          fail: (event) => {
            console.log(TAG_NAME, 'enterFullscreen fail', event)
            reject(event)
          },
        })
      })
    },

 "{{item.userID}}"  data-streamtype="{{item.streamType}}"  wx:for="{{streamList}}" wx:if="{{item.src && (item.hasVideo || item.hasAudio)}}" wx:key="streamID" class="view-container player-container {{item.isVisible?'':'none'}}" bindtap="_doubleTabToggleFullscreen" orientation= "{{item.orientation}}" mute-audio= "{{item.muteAudio}}" mute-video= "{{item.muteVideo}}">
          <live-player
              id="player"
              style="width:100%;height:600rpx;"
              class="player"
              id="{{item.streamID}}"
              data-userid="{{item.userID}}"
              data-streamid="{{item.streamID}}"
              src= "{{item.src}}"
              mode= "live"
              autoplay
              object-fit= "{{item.objectFit}}"
              min-cache= "{{item.minCache}}"
              max-cache= "{{item.maxCache}}"
              sound-mode= "{{item.soundMode}}"
              enable-recv-message= "{{item.enableRecvMessage}}"
              auto-pause-if-navigate= "{{item.autoPauseIfNavigate}}"
              auto-pause-if-open-native= "{{item.autoPauseIfOpenNative}}"
              debug="{{debug}}"
              bindstatechange="_playerStateChange"
              bindfullscreenchange="_playerFullscreenChange"
              bindnetstatus="_playerNetStatus"
              bindaudiovolumenotify  ="_playerAudioVolumeNotify"> 
          live-player>
      view>


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

1 个回答

  • 小辣椒
    小辣椒
    2020-08-19

    你好,麻烦具体描述问题流程,提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

    2020-08-19
    有用
    回复 2
    • 我爱你中国
      我爱你中国
      2020-08-31
      所有手机~
      _doubleTabToggleFullscreen(event) {
            // _setPlayerProperty
            const curTime = event.timeStamp
            const lastTime = this._lastTapTime
            const lastTapCoordinate = this._lastTapCoordinate
            const currentTapCoordinate = event.detail
            // 计算两次点击的距离
            const distence = Math.sqrt(Math.pow(Math.abs(currentTapCoordinate.x - lastTapCoordinate.x), 2) + Math.pow(Math.abs(currentTapCoordinate.y - lastTapCoordinate.y), 2))
            this._lastTapCoordinate = currentTapCoordinate
            // 已知问题:上次全屏操作后,必须等待1.5s后才能再次进行全屏操作,否则引发SDK全屏异常,因此增加节流逻辑
            const beforeLastTime = this._beforeLastTapTime
            console.log(TAG_NAME, '_doubleTabToggleFullscreen', event, lastTime, beforeLastTime, distence)
            if (curTime - lastTime > 0 && curTime - lastTime < 300 && lastTime - beforeLastTime > 1500 && distence < 20) {
              const userID = event.currentTarget.dataset.userid
              const streamType = event.currentTarget.dataset.streamtype
              if (this._isFullscreen) {
                this.exitFullscreen({ userID, streamType }).then(() => {
                  this._isFullscreen = false
                }).catch(() => {
                })
              } else {
                const stream = this.userController.getStream({ userID, streamType })
                let direction = 90
                // // 已知问题:视频的尺寸需要等待player触发NetStatus事件才能获取到,如果进房就双击全屏,全屏后的方向有可能不对。  
                console.log(this.userController.getStream({ userID, streamType }))
                if (stream && stream.videoWidth && stream.videoHeight) {
                  // 如果是横视频,全屏时进行横屏处理。如果是竖视频,则为0
                  direction = stream.videoWidth > stream.videoHeight ? 90 : 0
                }
                this.enterFullscreen({ userID, streamType, direction }).then(() => {
                  this._isFullscreen = true
                }).catch(() => {
                })
              }
              this._beforeLastTapTime = lastTime
            }
            this._lastTapTime = curTime
          },

      enterFullscreen(params) {
            console.log(TAG_NAME, 'enterFullscreen', params)
            return new Promise((resolve, reject) => {
              this.userController.getStream(params).playerContext.requestFullScreen({
                direction: params.direction || 0,
                success: (event) => {
                  console.log(TAG_NAME, 'enterFullscreen success', event)
                  resolve(event)
                },
                fail: (event) => {
                  console.log(TAG_NAME, 'enterFullscreen fail', event)
                  reject(event)
                },
              })
            })
          },
       "{{item.userID}}" data-streamtype="{{item.streamType}}" wx:for="{{streamList}}" wx:if="{{item.src && (item.hasVideo || item.hasAudio)}}" wx:key="streamID" class="view-container player-container {{item.isVisible?'':'none'}}" bindtap="_doubleTabToggleFullscreen" orientation= "{{item.orientation}}" mute-audio= "{{item.muteAudio}}" mute-video= "{{item.muteVideo}}">
                <live-player
                    id="player"
                    style="width:100%;height:600rpx;"
                    class="player"
                    id="{{item.streamID}}"
                    data-userid="{{item.userID}}"
                    data-streamid="{{item.streamID}}"
                    src= "{{item.src}}"
                    mode= "live"
                    autoplay
                    object-fit= "{{item.objectFit}}"
                    min-cache= "{{item.minCache}}"
                    max-cache= "{{item.maxCache}}"
                    sound-mode= "{{item.soundMode}}"
                    enable-recv-message= "{{item.enableRecvMessage}}"
                    auto-pause-if-navigate= "{{item.autoPauseIfNavigate}}"
                    auto-pause-if-open-native= "{{item.autoPauseIfOpenNative}}"
                    debug="{{debug}}"
                    bindstatechange="_playerStateChange"
                    bindfullscreenchange="_playerFullscreenChange"
                    bindnetstatus="_playerNetStatus"
                    bindaudiovolumenotify ="_playerAudioVolumeNotify">
                live-player>
            view>
      2020-08-31
      回复
    • 小辣椒
      小辣椒
      2020-08-31回复我爱你中国
      代码片段参考上面的链接来提供
      2020-08-31
      回复
登录 后发表内容
问题标签