Skip to content

Commit

Permalink
feat:虎牙直播在切换时不再会强制刷新播放窗口
Browse files Browse the repository at this point in the history
  • Loading branch information
dipelta committed Jan 10, 2024
1 parent 3132b1a commit eab873b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 45 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "live-plus-plus",
"version": "2.1.0",
"version": "2.2.0",
"private": true,
"description": "live++",
"author": "dipelta <[email protected]>",
Expand Down
3 changes: 3 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export default defineComponent({
case 'error':
self.msgColor = 'deep-orange-accent-2'
break;
case 'brown':
self.msgColor = 'brown-darken-1'
break;
default:
self.msgColor = 'light-blue-lighten-3'
break;
Expand Down
70 changes: 26 additions & 44 deletions src/views/Video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,65 +168,47 @@ export default defineComponent({
}
},
reloadVideoPlayer(newplatformTab, newRoomId) {
this.player.dispose();
this.$refs.videoPlayer.innerHTML = `<video id="live-player" class="video-js" style="border-radius: 5px"></video>`
let playerOptions = {
bigPlayButton: false,
textTrackDisplay: false,
posterImage: true,
errorDisplay: false,
autoplay: true,
fluid: true,
flvjs: {
mediaDataSource: {
isLive: true,
cors: false,
withCredentials: false,
},
},
}
this.player = videojs("live-player", playerOptions, function () {
// console.log("xxxx")
});
this.$nextTick(() => {
console.log('load')
// console.log('load')
this.reflushRoomInfo(newplatformTab, newRoomId)
})
},
reflushRoomInfo(platformTab, roomId) {
ipcRenderer.send('alert-msg', ['brown', '直播加载中...'])
ipcRenderer.invoke('get-live-url-info', [platformTab, roomId]).then((liveUrl) => {
// const player = toRaw(this.player)
const player = toRaw(this.player)
let liveUrlType = 'application/x-mpegURL' // hls
if (platformTab === 2) {
liveUrlType = 'video/x-flv'
}
// player.src({
// src: liveUrl,
// type: liveUrlType
// })
// this.player.src({
// src: liveUrl,
// type: liveUrlType
// })
player.src({
src: liveUrl,
type: liveUrlType
})
console.log("liveUrl")
console.log(liveUrl)
console.log("liveUrlType")
console.log(liveUrlType)
this.playerOptions = {
bigPlayButton: false,
textTrackDisplay: false,
posterImage: true,
errorDisplay: false,
autoplay: true,
fluid: true,
flvjs: {
mediaDataSource: {
isLive: true,
cors: false,
withCredentials: false,
},
},
// sources: [
// {
// src: liveUrl,
// type: liveUrlType
// }
// ]
}
this.player = videojs("live-player", this.playerOptions, function () {
console.log("xxxx")
});
this.player.src({
src: liveUrl,
type: liveUrlType
})
ipcRenderer.invoke('get-room-info', [platformTab, [roomId]]).then((data) => {
if (data) {
this.roomName = data[0].room_name
Expand Down

0 comments on commit eab873b

Please sign in to comment.