live-player.wxml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <view class="plv-player-live">
  2. <!-- 播放限制 -->
  3. <cover-view
  4. wx:if="{{ !canWatch }}"
  5. class="plv-player-live__canot__watch">
  6. <cover-image class="player-canot-watch__image" src="https://livestatic.videocc.net/v_84/assets/wimages/icon.png"></cover-image>
  7. <cover-view class="player-canot-watch__view">当前直播无法播放</cover-view>
  8. <cover-view class="player-canot-watch__view">
  9. 请刷新重试或向管理员反馈{{ errorCode }}
  10. </cover-view>
  11. </cover-view>
  12. <!-- 连麦按钮 -->
  13. <rtc-modal
  14. status="{{rtcStatus}}"
  15. visible="{{rtcVisible}}"
  16. bind:rtcRequestConnect="onRtcRequestConnect"
  17. bind:rtcCancelConnect="onRtcCancelConnect"
  18. bind:rtcHangUp="onRtcHangUp"
  19. ></rtc-modal>
  20. <!-- rtc直播间 -->
  21. <room
  22. id="plv-rtc-room-component"
  23. tokenParams="{{tokenParams}}"
  24. rtcMode="{{rtcMode}}"
  25. teacherNameplateInfo="{{teacherNameplateInfo}}"
  26. viewerNameplateInfo="{{viewerNameplateInfo}}"
  27. rtcDirection="{{rtcDirection}}"
  28. bind:publishStreamSuccess="onPublishStreamSuccess"
  29. bind:disconnectRoom="onDisconnectRoom"
  30. >
  31. <image class="plv-rtc-room-component-bg" src="{{ teacherNameplateInfo.avatar }}"/>
  32. <!-- <slot></slot> -->
  33. </room>
  34. <!-- 直播播放 当forceVideo为true则强制使用video组件直播 -->
  35. <!-- hidden="{{ rtcMode }}" -->
  36. <live-player
  37. wx:if="{{ liveMode === 1 && !forceVideo}}"
  38. hidden="{{ rtcMode }}"
  39. class="plv-player-live__player plv-player-live__player__live"
  40. id="plvLivePlayer"
  41. src="{{ videoSrc }}"
  42. min-cache="1"
  43. max-cache="1"
  44. autoplay="{{true}}"
  45. object-fit="{{ objectFit !== 'contain' ? 'fillCrop' : objectFit }}"
  46. catchtap="showPlayControl"
  47. picture-in-picture-mode="{{ pipMode }}"
  48. bindstatechange="onStateChange"
  49. auto-pause-if-navigate="{{autoPauseIfNavigate}}"
  50. auto-pause-if-open-native="{{autoPauseIfOpenNative}}"
  51. binderror="onLivePlayerError"
  52. >
  53. <danmu wx:if="{{ danmuEnabled && closeDanmuEnable === 'N' && isDocTypeAndNotSwitch && allowDanmu }}" />
  54. <skin
  55. wx:if="{{ (showControl || skinAlwaysShow )&& usePlayerSkin }}"
  56. lines="{{ lines }}"
  57. forceVideo="{{ forceVideo }}"
  58. liveMode="{{ liveMode }}"
  59. closeDanmuEnable="{{ closeDanmuEnable }}"
  60. changeScreenSuccess="{{ changeScreenSuccess }}"
  61. currentLine="{{ currentLine }}"
  62. currentRate="{{ currentRate }}"
  63. danmuEnabled="{{ danmuEnabled }}"
  64. allowDanmu="{{ allowDanmu }}"
  65. bind:changePlayStatus="changePlayStatus"
  66. bind:refresh="refresh"
  67. bind:changeScreen="changeScreen"
  68. bind:changeLine="changeLine"
  69. bind:updateDanmuEnabled="updateDanmuEnabled" />
  70. <!-- <slot></slot> -->
  71. </live-player>
  72. <!-- 暂存|回放列表| 暖场视频 -->
  73. <video
  74. wx:elif="{{ liveMode === 2 || (liveMode !== 0 && forceVideo) }}"
  75. class="plv-player-live__player plv-player-live__player__vod"
  76. id="plvLiveVodPlayer"
  77. src="{{ videoSrc }}"
  78. loop="{{ isWarm }}"
  79. controls="{{ liveMode === 2 }}"
  80. enable-danmu="{{ true }}"
  81. autoplay="{{ true }}"
  82. custom-cache="{{false}}"
  83. object-fit="{{ objectFit }}"
  84. picture-in-picture-mode="{{ pipMode }}"
  85. bindtap="showPlayControl"
  86. bindended="onLiveVodEnded"
  87. binderror="onLiveVodError"
  88. bindtimeupdate="onLiveTimeUpdate"
  89. auto-pause-if-navigate="{{autoPauseIfNavigate}}"
  90. auto-pause-if-open-native="{{autoPauseIfOpenNative}}"
  91. >
  92. <!-- <slot></slot> -->
  93. </video>
  94. <!-- 暖场图片 | 当前暂无直播 -->
  95. <block wx:else>
  96. <image
  97. src="{{ imgSrc }}"
  98. class="plv-player-live__player plv-player-live__player__image"
  99. mode="aspectFill"/>
  100. <!-- <slot></slot> -->
  101. </block>
  102. <danmu wx:if="{{ liveMode !== 2 && forceVideo && danmuEnabled && closeDanmuEnable === 'N' && allowDanmu }}" />
  103. <skin
  104. wx:if="{{ usePlayerSkin && forceVideo && ((showControl && ((liveMode === 1) || liveMode === 2)) || skinAlwaysShow) }}"
  105. liveMode="{{ liveMode }}"
  106. lines="{{ lines }}"
  107. forceVideo="{{ forceVideo }}"
  108. closeDanmuEnable="{{ closeDanmuEnable }}"
  109. changeScreenSuccess="{{ changeScreenSuccess }}"
  110. currentLine="{{ currentLine }}"
  111. currentRate="{{ currentRate }}"
  112. danmuEnabled="{{ danmuEnabled }}"
  113. bind:changePlayStatus="changePlayStatus"
  114. bind:refresh="refresh"
  115. bind:changeScreen="changeScreen"
  116. bind:changeLine="changeLine"
  117. bind:changeRate="changeRate"
  118. bind:updateDanmuEnabled="updateDanmuEnabled" />
  119. <slot></slot>
  120. </view>