| | |
| | | } |
| | | }; |
| | | |
| | | let playedOnce = false; |
| | | const init = () => { |
| | | if (player) { |
| | | destroy(); |
| | |
| | | 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: { |
| | |
| | | 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) => { |
| | |
| | | <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> |
| | |
| | | <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> |