style: 优化移动端视频播放窗口样式

This commit is contained in:
jmal 2024-06-09 14:53:05 +08:00
parent 565e056886
commit a475c456dd

View File

@ -79,7 +79,7 @@ export default {
style: { style: {
marginRight: this.$pc ? '20px' : '0px', marginRight: this.$pc ? '20px' : '0px',
}, },
html: `<a href="nplayer-videLink"><img style="width: 1.9rem;height: 1.9rem;line-height: 1.9rem" src="${require("@/assets/img/nplayer.webp")}"></a>`, html: `<a><img style="width: 1.9rem;height: 1.9rem;line-height: 1.9rem" src="${require("@/assets/img/nplayer.webp")}"></a>`,
index: 2, index: 2,
}, },
{ {
@ -89,7 +89,7 @@ export default {
style: { style: {
marginRight: this.$pc ? '20px' : '0px', marginRight: this.$pc ? '20px' : '0px',
}, },
html: `<a href="infuse://x-callback-url/play?url=videLink"><img style="width: 1.9rem;height: 1.9rem;line-height: 1.9rem" src="${require("@/assets/img/infuse.webp")}"></a>`, html: `<a><img style="width: 1.9rem;height: 1.9rem;line-height: 1.9rem" src="${require("@/assets/img/infuse.webp")}"></a>`,
index: 3, index: 3,
}, },
{ {
@ -125,6 +125,12 @@ export default {
watch: { watch: {
status: function (visible) { status: function (visible) {
if (visible) { if (visible) {
if (!this.$pc) {
// 去掉this.option.controls中name为 name: 'iina'
this.option.controls = this.option.controls.filter(item => item.name === 'nplayer' || item.name === 'infuse')
}
let videoUrl = fileConfig.previewUrl(this.$store.state.user.name, this.file, this.$store.getters.token) let videoUrl = fileConfig.previewUrl(this.$store.state.user.name, this.file, this.$store.getters.token)
if (this.shareId) { if (this.shareId) {
videoUrl = fileConfig.publicPreviewUrl(this.file, window.shareId, this.$store.getters.shareToken) videoUrl = fileConfig.publicPreviewUrl(this.file, window.shareId, this.$store.getters.shareToken)
@ -207,15 +213,24 @@ export default {
getInstance(art) { getInstance(art) {
this.art = art this.art = art
let doc = this.art.controls.$parent let doc = this.art.controls.$parent
// iina if (this.$pc) {
const iina = doc.querySelector('[data-index="1"]').querySelector('a'); // iina
iina.href = `iina://weblink?url=${this.videoLink}` const iina = doc.querySelector('[data-index="1"]').querySelector('a');
// nplayer iina.href = `iina://weblink?url=${this.videoLink}`
const nplayer = doc.querySelector('[data-index="2"]').querySelector('a'); // nplayer
nplayer.href = `nplayer-${this.videoLink}` const nplayer = doc.querySelector('[data-index="2"]').querySelector('a');
// infuse nplayer.href = `nplayer-${this.videoLink}`
const infuse = doc.querySelector('[data-index="3"]').querySelector('a'); // infuse
infuse.href = `infuse://x-callback-url/play?url=${this.videoLink}` const infuse = doc.querySelector('[data-index="3"]').querySelector('a');
infuse.href = `infuse://x-callback-url/play?url=${this.videoLink}`
} else {
// nplayer
const nplayer = doc.querySelector('[data-index="2"]').querySelector('a');
nplayer.href = `nplayer-${this.videoLink}`
// infuse
const infuse = doc.querySelector('[data-index="3"]').querySelector('a');
infuse.href = `infuse://x-callback-url/play?url=${this.videoLink}`
}
}, },
playM3u8(video, url, art) { playM3u8(video, url, art) {
if (Hls.isSupported()) { if (Hls.isSupported()) {