index.html引入sdk:
<link href="https://web.sdk.qcloud.com/player/tcplayer/release/v4.5.2/tcplayer.min.css" rel="stylesheet"/>
<script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.5.2/libs/hls.min.0.13.2m.js"></script>
<script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.5.2/tcplayer.v4.5.2.min.js"></script>
vue里面动态初始化:
initPlyer(){
const video = document.createElement("video")
video.setAttribute("id", "player-container-id")
video.setAttribute('playsinline',true)
video.setAttribute('webkit-playsinline',true)
video.setAttribute('autoplay',true)
document.getElementById("videoContain").appendChild(video)
this.player = TCPlayer('player-container-id', {});
},