wangzhibo
7 天以前 1c3ae7bcad167c9a593f4634968a6e142d9b08f9
src/modules/ezuikit/components/ezuikit-player.vue
@@ -99,6 +99,7 @@
  }
};
let playedOnce = false;
const init = () => {
  if (player) {
    destroy();
@@ -109,9 +110,9 @@
    id: props.containerId,
    accessToken: props.accessToken,
    url: props.url,
    autoplay: false,
    autoplay: true,
    template: "pcLive",
    height: 400,
    height: 360,
    scaleMode: 1,
    staticPath: props.staticPath || "",
    env: {
@@ -127,6 +128,14 @@
      console.error("handleError", err);
    }
  });
  player.on(EZUIKitPlayer.EVENTS.firstFrameDisplay, () => {
    if (playedOnce) return;
    playedOnce = true;
    setTimeout(() => {
      player?.pause();
    }, 1000);
  });
  // 事件监听
  player.on(EZUIKitPlayer.EVENTS.videoInfo, (info: any) => {
@@ -178,6 +187,7 @@
  <div class="ez-player-card">
    <!-- ID由父组件传入,保证全局唯一 -->
    <div :id="containerId" style="height: 400px;width:100%"></div>
    <!--
    <div class="player-buttons" style="margin-top:8px;display:flex;gap:6px;flex-wrap:wrap">
      <button @click="init">init</button>
      <button @click="stop">stop</button>
@@ -187,14 +197,15 @@
      <button @click="capturePicture">截图</button>
      <button @click="fullscreen">全屏</button>
    </div>
    -->
  </div>
</template>
<style scoped>
.ez-player-card {
  border: 1px solid #e4e7ed;
  border: 0px solid #e4e7ed;
  border-radius: 6px;
  padding: 8px;
  padding: 0px;
  background: #000;
}
</style>