This commit is contained in:
zoujiandong
2025-07-16 10:51:19 +08:00
parent b0f1a37ece
commit eb358d594b
66 changed files with 570 additions and 234 deletions
+15 -6
View File
@@ -3,8 +3,8 @@
</template>
<script setup>
import { onMounted, onUnmounted, ref } from 'vue';
const playJs=ref("//player.polyv.net/resp/live-h5-player/latest/liveplayer.min.js");
import { onMounted, onUnmounted, ref,watch} from 'vue';
const playJs=ref("//player.polyv.net/script/player.js");
const player=ref(null);
const props=defineProps({
vid:{
@@ -12,6 +12,10 @@ const props=defineProps({
default:''
}
})
const user_id=ref('');
watch(()=>props.vid,()=>{
loadPlayerScript(loadPlayer);
})
const loadPlayerScript=(callback)=> {
if (!window.polyvLivePlayer) {
const myScript = document.createElement('script');
@@ -23,17 +27,22 @@ const props=defineProps({
}
};
const loadPlayer=()=> {
let userInfo=uni.getStorageSync('userInfo');
if(userInfo.user_id){
user_id.value=userInfo.user_id;
}
const polyvLivePlayer = window.polyvLivePlayer;
player.value = polyvLivePlayer({
player.value = polyvPlayer({
wrap: '#player',
width: '100%',
height: 250,
forceH5:true,
df:3,
uid:user_id.vlaue,
vid: props.vid,
});
}
onMounted(()=>{
loadPlayerScript(loadPlayer);
})
onUnmounted(()=>{
player.value.destroy();
})