custom.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <uni-shadow-root class="trtc-room-template-custom-custom"><template v-if="wxTemplateName === 'custom'">
  3. <view class="template-custom">
  4. <view class="players-container">
  5. <view v-for="(item,index) in (streamList)" :key="item.streamID" v-if="item.src && (item.hasVideo || item.hasAudio)" :class="'view-container player-container '+(item.isVisible?'':'none')" :style="'left:'+(item.xAxis)+';top:'+(item.yAxis)+';width:'+(item.width)+';height:'+(item.height)+';z-index:'+(item.zIndex)+';'">
  6. <live-player class="player" :id="item.streamID" :data-userid="item.userID" :data-streamid="item.streamID" :data-streamtype="item.streamType" :src="item.src" :mode="item.mode" :autoplay="item.autoplay" :mute-audio="item.muteAudio" :mute-video="item.muteVideo" :orientation="item.orientation" :object-fit="item.objectFit" :background-mute="item.enableBackgroundMute" :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" @statechange="_$self.$parent[('_playerStateChange')]($event)" @fullscreenchange="_$self.$parent[('_playerFullscreenChange')]($event)" @netstatus="_$self.$parent[('_playerNetStatus')]($event)" @audiovolumenotify="_$self.$parent[('_playerAudioVolumeNotify')]($event)"></live-player>
  7. </view>
  8. </view>
  9. <view :class="'view-container pusher-container '+(pusher.isVisible?'':'none')" :style="'left:'+(pusher.xAxis)+';top:'+(pusher.yAxis)+';width:'+(pusher.width)+';height:'+(pusher.height)+';z-index:'+(pusher.zIndex)+';'">
  10. <live-pusher class="pusher" :url="pusher.url" :mode="pusher.mode" :autopush="pusher.autopush" :enable-camera="pusher.enableCamera" :enable-mic="pusher.enableMic" :muted="(!pusher.enableMic)" :enable-agc="pusher.enableAgc" :enable-ans="pusher.enableAns" :enable-ear-monitor="pusher.enableEarMonitor" :auto-focus="pusher.enableAutoFocus" :zoom="pusher.enableZoom" :min-bitrate="pusher.minBitrate" :max-bitrate="pusher.maxBitrate" :video-width="pusher.videoWidth" :video-height="pusher.videoHeight" :beauty="pusher.beautyLevel" :whiteness="pusher.whitenessLevel" :orientation="pusher.videoOrientation" :aspect="pusher.videoAspect" :device-position="pusher.frontCamera" :remote-mirror="pusher.enableRemoteMirror" :local-mirror="pusher.localMirror" :background-mute="pusher.enableBackgroundMute" :audio-quality="pusher.audioQuality" :audio-volume-type="pusher.audioVolumeType" :audio-reverb-type="pusher.audioReverbType" :waiting-image="pusher.waitingImage" :debug="debug" @statechange="_$self.$parent[('_pusherStateChangeHandler')]($event)" @netstatus="_$self.$parent[('_pusherNetStatusHandler')]($event)" @error="_$self.$parent[('_pusherErrorHandler')]($event)" @bgmstart="_$self.$parent[('_pusherBGMStartHandler')]($event)" @bgmprogress="_$self.$parent[('_pusherBGMProgressHandler')]($event)" @bgmcomplete="_$self.$parent[('_pusherBGMCompleteHandler')]($event)" @audiovolumenotify="_$self.$parent[('_pusherAudioVolumeNotify')]($event)"></live-pusher>
  11. </view>
  12. </view>
  13. </template></uni-shadow-root>
  14. </template>
  15. <script>
  16. global['__wxRoute'] = 'trtc-room/template/custom/custom'
  17. Component({})
  18. export default global['__wxComponents']['trtc-room/template/custom/custom']
  19. </script>
  20. <style platform="mp-weixin">
  21. /* 通过方法自定义模式 */
  22. .template-custom{
  23. /* 绝对定位模式 pusher 和 player 都用绝对定位*/
  24. width: 100vw;
  25. height: 100vh;
  26. position: relative;
  27. }
  28. .template-custom .pusher-container,
  29. .template-custom .player-container{
  30. position: absolute;
  31. }
  32. </style>