From e31b92148638c290510cced40c42652efde984c4 Mon Sep 17 00:00:00 2001
From: buvta <12312540+buvta@users.noreply.github.com>
Date: Tue, 29 Dec 2020 21:12:14 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DPlay=E7=82=B9=E6=92=ADm3u8?=
=?UTF-8?q?=E6=92=AD=E6=94=BE=E5=88=97=E8=A1=A8=E5=AF=BC=E5=87=BA=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/Play.vue | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/components/Play.vue b/src/components/Play.vue
index f616a21..0070f77 100644
--- a/src/components/Play.vue
+++ b/src/components/Play.vue
@@ -183,7 +183,7 @@
- - 导出
+ - 导出
- 无数据
- {{i | ftName(j)}}
@@ -365,7 +365,8 @@ export default {
skipendStatus: false, // 是否跳过了片尾
currentShortcutList: [],
onlineUrl: '',
- playerType: 'hls'
+ playerType: 'hls',
+ exportablePlaylist: false
}
},
filters: {
@@ -609,8 +610,10 @@ export default {
},
playVideo (index = 0, time = 0) {
this.isLive = false
+ this.exportablePlaylist = false
this.fetchPlaylist().then(async (playlistUrls) => {
const url = playlistUrls[index]
+ if (playlistUrls.every(e => e.endsWith('.m3u8'))) this.exportablePlaylist = true
if (!url.endsWith('.m3u8') && !url.endsWith('.mp4')) {
const currentSite = await sites.find({ key: this.video.key })
if (currentSite.jiexiUrl) {
@@ -1004,15 +1007,15 @@ export default {
link: link
})
}
- let m3u8Content = '#EXTM3U'
+ let m3u8Content = '#EXTM3U\n'
for (const item of m3u8Arr) {
- m3u8Content += `#EXTINF:-1, ${item.name}\n${item.link}`
+ m3u8Content += `#EXTINF:-1, ${item.name}\n${item.link}\n`
}
const blob = new Blob([m3u8Content], { type: 'application/vnd.apple.mpegurl' })
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
downloadElement.href = href
- downloadElement.download = `${this.name}.m3u8`
+ downloadElement.download = `${this.name}.m3u`
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)