wg-video-player 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +13 -0
- package/README.md +180 -0
- package/dist/style.css +1 -0
- package/dist/wg-video-player.js +165261 -0
- package/dist/wg-video-player.umd.cjs +995 -0
- package/examples/App.vue +341 -0
- package/examples/fakeData.js +743 -0
- package/examples/main.js +32 -0
- package/package.json +56 -0
- package/uno.config.ts +12 -0
- package/vite.config.js +65 -0
- package/wg-video-player.d.ts +52 -0
package/examples/main.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// import Vue from 'vue';
|
|
2
|
+
import { createApp } from 'vue';
|
|
3
|
+
// import VueI18n from 'vue-i18n';
|
|
4
|
+
import { createI18n } from 'vue-i18n';
|
|
5
|
+
import App from './App.vue';
|
|
6
|
+
import multiPlayer from '../src/index';
|
|
7
|
+
|
|
8
|
+
// Vue.use(VueI18n);
|
|
9
|
+
|
|
10
|
+
const messages = {
|
|
11
|
+
tw: { message: '視頻', ...multiPlayer.langs.tw },
|
|
12
|
+
cn: { message: '视频', ...multiPlayer.langs.cn },
|
|
13
|
+
us: { message: 'video', ...multiPlayer.langs.us },
|
|
14
|
+
};
|
|
15
|
+
const i18n = createI18n({
|
|
16
|
+
locale: 'cn',
|
|
17
|
+
messages,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const app = createApp(App);
|
|
21
|
+
|
|
22
|
+
app.use(multiPlayer);
|
|
23
|
+
app.use(i18n);
|
|
24
|
+
|
|
25
|
+
app.mount('#app');
|
|
26
|
+
// eslint-disable-next-line no-new
|
|
27
|
+
// new Vue({
|
|
28
|
+
// el: '#app',
|
|
29
|
+
// render: (h) => h(App),
|
|
30
|
+
// i18n,
|
|
31
|
+
// });
|
|
32
|
+
// import '../src/test';
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wg-video-player",
|
|
3
|
+
"description": "A video player for private",
|
|
4
|
+
"version": "1.0.0-beta.0",
|
|
5
|
+
"author": "wg <wg@wisdomgarden.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"private": false,
|
|
8
|
+
"type": "module",
|
|
9
|
+
"types": "wg-video-player.d.ts",
|
|
10
|
+
"main": "./dist/wg-video-player.umd.js",
|
|
11
|
+
"module": "./dist/wg-video-player.js",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/wg-video-player.js",
|
|
15
|
+
"require": "./dist/wg-video-player.umd.js"
|
|
16
|
+
},
|
|
17
|
+
"./style.css": "./dist/style.css"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build": "vite build",
|
|
22
|
+
"preview": "vite preview",
|
|
23
|
+
"prepare": "vite build",
|
|
24
|
+
"dist": "vite build"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@vitejs/plugin-vue": "^4.4.0",
|
|
28
|
+
"less": "^4.2.0",
|
|
29
|
+
"sass": "^1.69.4",
|
|
30
|
+
"unocss": "^0.56.5",
|
|
31
|
+
"vite": "^4.5.0"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@ant-design/icons-vue": "^7.0.1",
|
|
35
|
+
"@popperjs/core": "^2.11.8",
|
|
36
|
+
"@silvermine/videojs-quality-selector": "^1.3.0",
|
|
37
|
+
"ant-design-vue": "^4.0.6",
|
|
38
|
+
"axios": "^1.5.1",
|
|
39
|
+
"chance": "^1.1.11",
|
|
40
|
+
"element-resize-event": "^3.0.6",
|
|
41
|
+
"emoji-mart-vue": "^2.6.6",
|
|
42
|
+
"flv.js": "^1.6.2",
|
|
43
|
+
"jquery": "^3.7.1",
|
|
44
|
+
"jwt-decode": "^3.1.2",
|
|
45
|
+
"lodash": "^4.17.21",
|
|
46
|
+
"md5": "^2.3.0",
|
|
47
|
+
"socket.io-client": "^4.7.2",
|
|
48
|
+
"uuid": "^9.0.1",
|
|
49
|
+
"v3-infinite-loading": "^1.3.1",
|
|
50
|
+
"video.js": "7.20.2",
|
|
51
|
+
"vite-svg-loader": "^4.0.0",
|
|
52
|
+
"vue": "^3.3.5",
|
|
53
|
+
"vue-i18n": "^9.5.0",
|
|
54
|
+
"vuewordcloud": "^19.0.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
package/uno.config.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineConfig, presetAttributify, presetUno, transformerVariantGroup } from 'unocss';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
theme: {
|
|
5
|
+
colors: {
|
|
6
|
+
primary: '#00bbbd',
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
presets: [presetUno({ prefix: 'mvp-uno-' }), presetAttributify()],
|
|
10
|
+
transformers: [transformerVariantGroup()],
|
|
11
|
+
rules: [['m-1', { margin: '0.25rem' }]],
|
|
12
|
+
});
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { defineConfig, loadEnv } from 'vite';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
import vue from '@vitejs/plugin-vue';
|
|
4
|
+
import UnoCSS from 'unocss/vite';
|
|
5
|
+
import svgLoader from 'vite-svg-loader';
|
|
6
|
+
|
|
7
|
+
export default ({ mode }) => {
|
|
8
|
+
const { VITE_PORT, VITE_BASE_URL } = loadEnv(mode, process.cwd());
|
|
9
|
+
|
|
10
|
+
return defineConfig({
|
|
11
|
+
base: VITE_BASE_URL,
|
|
12
|
+
plugins: [
|
|
13
|
+
vue(),
|
|
14
|
+
UnoCSS(),
|
|
15
|
+
svgLoader(),
|
|
16
|
+
// AutoImport({
|
|
17
|
+
// resolvers: [],
|
|
18
|
+
// }),
|
|
19
|
+
// Components({
|
|
20
|
+
// resolvers: [
|
|
21
|
+
// TDesignResolver({
|
|
22
|
+
// library: 'vue-next',
|
|
23
|
+
// }),
|
|
24
|
+
// ],
|
|
25
|
+
// }),
|
|
26
|
+
],
|
|
27
|
+
resolve: {
|
|
28
|
+
alias: {
|
|
29
|
+
'@': resolve(__dirname, 'src'),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
css: {},
|
|
33
|
+
server: {
|
|
34
|
+
// 是否开启 https
|
|
35
|
+
https: false,
|
|
36
|
+
// 端口号
|
|
37
|
+
port: VITE_PORT,
|
|
38
|
+
// 监听所有地址
|
|
39
|
+
host: '0.0.0.0',
|
|
40
|
+
// 服务启动时是否自动打开浏览器
|
|
41
|
+
open: true,
|
|
42
|
+
// 允许跨域
|
|
43
|
+
cors: true,
|
|
44
|
+
// 自定义代理规则
|
|
45
|
+
proxy: {},
|
|
46
|
+
},
|
|
47
|
+
build: {
|
|
48
|
+
// 设置最终构建的浏览器兼容目标
|
|
49
|
+
target: 'es2015',
|
|
50
|
+
// 构建后是否生成 source map 文件
|
|
51
|
+
sourcemap: false,
|
|
52
|
+
// chunk 大小警告的限制(以 kbs 为单位)
|
|
53
|
+
chunkSizeWarningLimit: 2000,
|
|
54
|
+
// 启用/禁用 gzip 压缩大小报告
|
|
55
|
+
reportCompressedSize: false,
|
|
56
|
+
lib: {
|
|
57
|
+
// Could also be a dictionary or array of multiple entry points
|
|
58
|
+
entry: resolve(__dirname, 'src/index.js'),
|
|
59
|
+
name: 'WgVideoPlayer',
|
|
60
|
+
// the proper extensions will be added
|
|
61
|
+
fileName: 'wg-video-player',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { PluginFunction } from 'vue';
|
|
2
|
+
|
|
3
|
+
declare module 'wg-video-player';
|
|
4
|
+
|
|
5
|
+
export interface MultiPlayerProps {
|
|
6
|
+
videos: Record<string, any>[]
|
|
7
|
+
mode?: string
|
|
8
|
+
volume?: number
|
|
9
|
+
plugins?: Record<string, any>
|
|
10
|
+
autoPlay?: boolean
|
|
11
|
+
seekable?: boolean
|
|
12
|
+
seekWarning?: string
|
|
13
|
+
lastPlayed?: number
|
|
14
|
+
isSimpleControls?: boolean
|
|
15
|
+
enablePlayRate?: boolean
|
|
16
|
+
enableNew?: boolean
|
|
17
|
+
onPlayerReady: Function,
|
|
18
|
+
onError: Function
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type ListenerName = 'playerReady' | 'error'
|
|
22
|
+
|
|
23
|
+
export type VideoLanguage = 'cn' | 'tw' | 'us'
|
|
24
|
+
|
|
25
|
+
export class MultiPlayer {
|
|
26
|
+
playerComponent: Record<string, any>
|
|
27
|
+
constructor(id: string, props: MultiPlayerProps, options?: Record<string, any>) { }
|
|
28
|
+
|
|
29
|
+
// on(
|
|
30
|
+
// fnName: ListenerName,
|
|
31
|
+
// fn: Function,
|
|
32
|
+
// ): void
|
|
33
|
+
|
|
34
|
+
// off(
|
|
35
|
+
// fnName: ListenerName,
|
|
36
|
+
// fn: Function,
|
|
37
|
+
// ): void
|
|
38
|
+
|
|
39
|
+
locale(language: VideoLanguage): void
|
|
40
|
+
|
|
41
|
+
destroy(): void
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const API: {
|
|
45
|
+
locale: Function,
|
|
46
|
+
i18n: Function,
|
|
47
|
+
langs: Record<string, any>,
|
|
48
|
+
install: PluginFunction<any>,
|
|
49
|
+
MultiPlayer: MultiPlayer,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default API;
|