小程序live-player和live-pusher引起的音频暂停问题,应该是内部bug?
发布于 5 年前 作者 yangxiulan 726 次浏览 来自 官方Issues

复现场景:小程序webview的页面中有个audio音频元素正在播放,点击按钮使livePusher和livePlayer一起渲染后,该音频元素暂停播放

说明:单独使用livePusher或者livePlayer不会导致音频暂停播放

1 回复

复现demo

export default class AudioLive extends Component<any, any> {

  constructor(props){
    super(props)
    this.state = {
      livePlay: false,
      pusher: null
    }
  }
 
  handleClick() {
    console.log('开始推拉流')
    this.setState({
      livePlay: true,
      pusher: {
        url: 'rtmp://...'  // 有效地址
      }
    })
  }
  render() {
    const enowPlayUrl = 'http://...:8081'
    return (
      <WebView
        className='audio-live-page-1'
        src={enowPlayUrl}
        >
          <CoverView className="cover">
            <CoverView className='btn'>
              <Button type="default" size='mini' className="cover-button" onClick={this.handleClick}>推拉流</Button>
            </CoverView>
          </CoverView>
          {
            this.state.livePlay &&
            <LivePlayer
              src={"rtmp://58.200.131.2:1935/livetv/gdtv"}
              mode='live'
              autoplay
              id={`live-video`}
              className={`live-video`}
              muted={false}
              orientation='vertical'
              objectFit='contain'
              backgroundMute
              minCache={0.2}
              maxCache={0.8}
              onStateChange={() => {}}
            >
            </LivePlayer>
          }
          {
            this.state.pusher &&
            <LivePusher
              url={this.state.pusher.url}
              mode="RTC"
              aspect="9:16"
              className="camera"
              onStateChange={() => {}}
              onError={() => {}}
              onNetstatus={() => {}}
              backgroundMute={true}
              muted={false}
              maxBitrate={500}
              minBitrate={200}
              waitingImage="https://webdemo.agora.io/away.png"
              waitingImageHash={''}
              autopush={true}
              enableCamera={false}
              autoFocus={true}
              orientation={'vertical'}
              beauty={3}
              whiteness={2}
              zoom={false}
          />
          }
      </WebView>
    );
  }

}


// webview内嵌页面html
 
 
<!DOCTYPE html>
 
<html>
 
<head>
 
<meta charset="utf-8">
 
<meta name="viewport" content="width=device-width">
 
<title>Audio</title>
 
</head>
 
<body>
 
<div>
 
<audio controls="controls" volume=“0.1” src=""></audio>
 
</div>
 
</body>
 
</html>
回到顶部