2 回复
live-player和live-pusher:
1: live-player 绝对定位absolute占满屏幕
2:都用wx:if 控制显示就ok
< view wx:if = "{{!isCalling}}" class = 'fullscreen' > < view class = 'video-wrapper' > < live-player id = "yunxin-player" wx:if = "{{playerUrl}}" src = "{{playerUrl}}" mode = "RTC" autoplay min-cache = "{{0.1}}" max-cache = "{{0.3}}" @ statechange = "statechangeplayer" @ error = "errorplayer" style = "position: absolute; width: 100%; height: 100vh; top: 0; left: 0;background-color: transparent;" > < cover-view class = 'control-wrapper' > < cover-view class = 'netcall-time-text' >{{duration}}</ cover-view > < cover-image class = "item" src = "/assets/img/yunxin/netcall-revert-camera.png" @ tap.stop = "switchCameraHandler" >切摄像头</ cover-image > < cover-image class = "item" src = "/assets/img/yunxin/netcall-camera{{enableCamera ? '' : '-close'}}.png" data-mode = "1" @ tap.stop = "switchMeetingModeHandler" >关闭摄像头</ cover-image > < cover-image class = "item" src = "/assets/img/yunxin/netcall-micro{{muted ? '-close' : ''}}.png" data-mode = "2" @ tap.stop = "switchMeetingModeHandler" >关闭麦克风</ cover-image > < cover-image class = "item" src = "/assets/img/yunxin/netcall-reject.png" @ tap.stop = "hangupHandler" >挂断</ cover-image > </ cover-view > </ live-player > < live-pusher id = "yunxin-pusher" wx:if = "{{playerUrl}}" url = "{{userlist[0].url}}" mode = "RTC" autopush @ statechange = "statechangepusher" @ netstatus = "netstatus" enable-camera = "{{enableCamera}}" muted = "{{muted}}" style = "width: 100px; height: 150px;right: -260px;top: 30px;" /> </ view > </ view > |
附上代码片段(网易云音视频通讯demo)
3.推流地址一开始就获取到了,但是拉流地址要等人接进来才有。故当playerUrl存在的时候显示live-player和live-pusher即可实现