From 4a098d3718ee2563690e87b1cda39a2497bb99f7 Mon Sep 17 00:00:00 2001 From: Aicirou <2643053021@qq.com> Date: Wed, 24 Jun 2020 01:10:41 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8Add=20Video=20Default=20Player(plyr)?= =?UTF-8?q?=20#22=20#38?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dependencies-cdn.js | 1 - package-lock.json | 83 +++++++++++++++++++++++++++++++++++ package.json | 4 ++ public/index.html | 3 +- src/main.js | 4 +- src/utils/AcrouUtil.js | 2 +- src/views/page/GoVideo.vue | 90 ++++++++++++++++++++++++++++++++++++-- yarn.lock | 41 ++++++++++++++++- 8 files changed, 219 insertions(+), 9 deletions(-) diff --git a/dependencies-cdn.js b/dependencies-cdn.js index ec26ba5..8fddfcf 100644 --- a/dependencies-cdn.js +++ b/dependencies-cdn.js @@ -9,7 +9,6 @@ module.exports = [ { name: 'js-cookie', library: 'Cookies', js: 'https://cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.min.js', css: '' }, { name: 'lowdb', library: 'low', js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/low.min.js', css: '' }, { name: 'lowdb/adapters/LocalStorage', library: 'LocalStorage', js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/LocalStorage.min.js', css: '' }, - { name: 'markdown-it', library: 'markdownit', js: 'https://cdn.jsdelivr.net/npm/markdown-it@10.0.0/dist/markdown-it.min.js', css: '' }, { name: '', library: '', js: 'https://at.alicdn.com/t/font_1760192_axq33n6snd.js', css: '' }, { name: '', library: '', js: '', css: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css' }, { name: '', library: '', js: '', css: 'https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css' }, diff --git a/package-lock.json b/package-lock.json index 07a94f3..5ebbf99 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4111,6 +4111,11 @@ "array-find-index": "^1.0.1" } }, + "custom-event-polyfill": { + "version": "1.0.7", + "resolved": "https://registry.npm.taobao.org/custom-event-polyfill/download/custom-event-polyfill-1.0.7.tgz", + "integrity": "sha1-m8mT3dqTfBowzNM1YUxsWMT4eu4=" + }, "cyclist": { "version": "1.0.1", "resolved": "http://registry.npm.taobao.org/cyclist/download/cyclist-1.0.1.tgz", @@ -4775,6 +4780,11 @@ "is-symbol": "^1.0.2" } }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npm.taobao.org/es6-promise/download/es6-promise-4.2.8.tgz", + "integrity": "sha1-TrIVlMlyvEBVPSduUQU5FD21Pgo=" + }, "escape-html": { "version": "1.0.3", "resolved": "http://registry.npm.taobao.org/escape-html/download/escape-html-1.0.3.tgz", @@ -5516,6 +5526,15 @@ "readable-stream": "^2.3.6" } }, + "flv.js": { + "version": "1.5.0", + "resolved": "https://registry.npm.taobao.org/flv.js/download/flv.js-1.5.0.tgz", + "integrity": "sha1-+lm+1DkdcENc+odArEDsAHDvmK4=", + "requires": { + "es6-promise": "^4.2.5", + "webworkify": "^1.5.0" + } + }, "follow-redirects": { "version": "1.11.0", "resolved": "https://registry.npm.taobao.org/follow-redirects/download/follow-redirects-1.11.0.tgz?cache=0&sync_timestamp=1585479417937&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffollow-redirects%2Fdownload%2Ffollow-redirects-1.11.0.tgz", @@ -6527,6 +6546,22 @@ "integrity": "sha1-TAb8y0YC/iYCs8k9+C1+fb8aio4=", "dev": true }, + "hls.js": { + "version": "0.13.2", + "resolved": "https://registry.npm.taobao.org/hls.js/download/hls.js-0.13.2.tgz", + "integrity": "sha1-Pn3SjjeHxpxqukK2SxHrLDyMKfE=", + "requires": { + "eventemitter3": "3.1.0", + "url-toolkit": "^2.1.6" + }, + "dependencies": { + "eventemitter3": { + "version": "3.1.0", + "resolved": "https://registry.npm.taobao.org/eventemitter3/download/eventemitter3-3.1.0.tgz?cache=0&sync_timestamp=1589283105849&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Feventemitter3%2Fdownload%2Feventemitter3-3.1.0.tgz", + "integrity": "sha1-CQtNbNvWRe0Qv3UNS1QHlC17oWM=" + } + } + }, "hmac-drbg": { "version": "1.0.1", "resolved": "http://registry.npm.taobao.org/hmac-drbg/download/hmac-drbg-1.0.1.tgz", @@ -7702,6 +7737,11 @@ } } }, + "loadjs": { + "version": "4.2.0", + "resolved": "https://registry.npm.taobao.org/loadjs/download/loadjs-4.2.0.tgz", + "integrity": "sha1-KgM2N2OXpqQ+35jJ7DIp3dWrtvY=" + }, "locate-path": { "version": "2.0.0", "resolved": "https://registry.npm.taobao.org/locate-path/download/locate-path-2.0.0.tgz", @@ -9988,6 +10028,11 @@ "integrity": "sha1-PPNwI9GZ4cJNGlW4SADC8+ZGgDE=", "dev": true }, + "rangetouch": { + "version": "2.0.1", + "resolved": "https://registry.npm.taobao.org/rangetouch/download/rangetouch-2.0.1.tgz", + "integrity": "sha1-wBEFEQ/Tr8oq3LGlgGkoN9iDy3A=" + }, "raw-body": { "version": "2.4.0", "resolved": "https://registry.npm.taobao.org/raw-body/download/raw-body-2.4.0.tgz", @@ -12152,6 +12197,16 @@ "requires-port": "^1.0.0" } }, + "url-polyfill": { + "version": "1.1.9", + "resolved": "https://registry.npm.taobao.org/url-polyfill/download/url-polyfill-1.1.9.tgz", + "integrity": "sha1-LI1CJIiaXJQoAPcI9VhTaAhWA9k=" + }, + "url-toolkit": { + "version": "2.2.0", + "resolved": "https://registry.npm.taobao.org/url-toolkit/download/url-toolkit-2.2.0.tgz", + "integrity": "sha1-mle4nzFdS33DQOFQvPpUjd9fXOk=" + }, "use": { "version": "3.1.1", "resolved": "http://registry.npm.taobao.org/use/download/use-3.1.1.tgz", @@ -12542,6 +12597,29 @@ } } }, + "vue-plyr": { + "version": "6.0.4", + "resolved": "https://registry.npm.taobao.org/vue-plyr/download/vue-plyr-6.0.4.tgz", + "integrity": "sha1-eINNx0U3rjBtGNni5csNQqFxjv0=", + "requires": { + "plyr": "^3.5.6", + "vue": "^2.6.10" + }, + "dependencies": { + "plyr": { + "version": "3.6.2", + "resolved": "https://registry.npm.taobao.org/plyr/download/plyr-3.6.2.tgz", + "integrity": "sha1-WlW2CKzRYSYt4cx1yoQ6pkNVoFE=", + "requires": { + "core-js": "^3.6.5", + "custom-event-polyfill": "^1.0.7", + "loadjs": "^4.2.0", + "rangetouch": "^2.0.1", + "url-polyfill": "^1.1.8" + } + } + } + }, "vue-router": { "version": "3.1.6", "resolved": "https://registry.npm.taobao.org/vue-router/download/vue-router-3.1.6.tgz?cache=0&sync_timestamp=1588196200689&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-router%2Fdownload%2Fvue-router-3.1.6.tgz", @@ -13033,6 +13111,11 @@ "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", "dev": true }, + "webworkify": { + "version": "1.5.0", + "resolved": "https://registry.npm.taobao.org/webworkify/download/webworkify-1.5.0.tgz", + "integrity": "sha1-c0rYendN5uvdVG4dPgJ9pbj0pCw=" + }, "which": { "version": "1.3.1", "resolved": "https://registry.npm.taobao.org/which/download/which-1.3.1.tgz", diff --git a/package.json b/package.json index 24112ed..30f176e 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,15 @@ "core-js": "^3.6.4", "element-ui": "^2.13.1", "feb-alive": "^1.0.9", + "flv.js": "^1.5.0", + "hls.js": "^0.13.2", "js-base64": "^2.5.2", "js-cookie": "^2.2.1", "lodash": "^4.17.15", "lowdb": "^1.0.0", "marked": "^1.1.0", "node-sass": "^4.14.0", + "plyr": "^3.6.2", "sass-loader": "^8.0.2", "v-viewer": "^1.5.1", "vue": "^2.6.11", @@ -31,6 +34,7 @@ "vue-i18n": "^8.17.3", "vue-infinite-loading": "^2.4.5", "vue-lazyload": "^1.3.3", + "vue-plyr": "^6.0.4", "vue-router": "^3.1.6", "vuex": "^3.4.0" }, diff --git a/public/index.html b/public/index.html index a9ba34a..114c9ce 100644 --- a/public/index.html +++ b/public/index.html @@ -44,7 +44,8 @@ desc: true, }, player: { - api: "https://api.jsonpop.cn/demo/blplyaer/?url=" + api: "", + autoplay: true } } window.gdconfig = JSON.parse(JSON.stringify({ version: authConfig.version, themeOptions: themeOptions })); diff --git a/src/main.js b/src/main.js index 1e5fe64..5bea464 100644 --- a/src/main.js +++ b/src/main.js @@ -13,9 +13,10 @@ import store from "@/store/index"; import VueClipboard from "vue-clipboard2"; import VueLazyload from "vue-lazyload"; import Viewer from "v-viewer"; +import VuePlyr from "vue-plyr"; import cdnpath from "./libs/util.cdn"; // 组件 -import '@/components' +import "@/components"; import "viewerjs/dist/viewer.css"; import "@/assets/style/theme/register.scss"; @@ -31,6 +32,7 @@ Vue.use(VueLazyload, { loading: cdnpath("images/airplane.gif"), }); Vue.use(Viewer); +Vue.use(VuePlyr); new Vue({ router, diff --git a/src/utils/AcrouUtil.js b/src/utils/AcrouUtil.js index bf1e3f9..5d1bb1f 100644 --- a/src/utils/AcrouUtil.js +++ b/src/utils/AcrouUtil.js @@ -13,7 +13,7 @@ const text_exts = [ "sh", "md", ]; -const video_exts = ["mp4", "webm", "mkv", "m3u8"]; +const video_exts = ["mp4", "webm", "mkv", "m3u8", "flv"]; const image_exts = ["bmp", "jpg", "jpeg", "png", "gif"]; const pdf_exts = ["pdf"]; diff --git a/src/views/page/GoVideo.vue b/src/views/page/GoVideo.vue index c76058a..2234c1a 100644 --- a/src/views/page/GoVideo.vue +++ b/src/views/page/GoVideo.vue @@ -14,9 +14,20 @@ allowfullscreen="true" > - +
+ + + +

@@ -62,6 +73,8 @@