ckplayer-plus 1.0.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/package.json ADDED
@@ -0,0 +1,110 @@
1
+ {
2
+ "name": "ckplayer-plus",
3
+ "version": "1.0.0",
4
+ "description": "Enhanced ckplayer X3 packaging with Vue 2/3 and React wrappers — ESM-ready HTML5 video player",
5
+ "keywords": [
6
+ "ckplayer",
7
+ "ckplayer-plus",
8
+ "video",
9
+ "player",
10
+ "hls",
11
+ "flv",
12
+ "m3u8",
13
+ "mpegts",
14
+ "vue",
15
+ "react",
16
+ "html5"
17
+ ],
18
+ "license": "MIT",
19
+ "author": "",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://gitee.com/yuanlonghui/video-playback.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://gitee.com/yuanlonghui/video-playback/issues"
26
+ },
27
+ "homepage": "https://gitee.com/yuanlonghui/video-playback#readme",
28
+ "main": "./dist/index.cjs",
29
+ "module": "./dist/index.js",
30
+ "types": "./types/index.d.ts",
31
+ "unpkg": "./dist/ckplayer.min.js",
32
+ "jsdelivr": "./dist/ckplayer.min.js",
33
+ "sideEffects": [
34
+ "*.css",
35
+ "./dist/ckplayer.js",
36
+ "./dist/ckplayer.min.js"
37
+ ],
38
+ "exports": {
39
+ ".": {
40
+ "types": "./types/index.d.ts",
41
+ "import": "./dist/index.js",
42
+ "require": "./dist/index.cjs"
43
+ },
44
+ "./vue": {
45
+ "types": "./types/vue.d.ts",
46
+ "import": "./dist/vue.js",
47
+ "require": "./dist/vue.cjs"
48
+ },
49
+ "./react": {
50
+ "types": "./types/react.d.ts",
51
+ "import": "./dist/react.js",
52
+ "require": "./dist/react.cjs"
53
+ },
54
+ "./style.css": "./dist/ckplayer.css",
55
+ "./ckplayer.css": "./dist/ckplayer.css",
56
+ "./ckplayer.min.js": "./dist/ckplayer.min.js",
57
+ "./package.json": "./package.json"
58
+ },
59
+ "files": [
60
+ "dist",
61
+ "types",
62
+ "LICENSE",
63
+ "README.md"
64
+ ],
65
+ "scripts": {
66
+ "build": "node scripts/build.mjs",
67
+ "prepublishOnly": "npm run build"
68
+ },
69
+ "peerDependencies": {
70
+ "vue": "^2.7.0 || ^3.0.0",
71
+ "react": ">=16.8.0",
72
+ "react-dom": ">=16.8.0",
73
+ "hls.js": "^1.0.0",
74
+ "flv.js": "^1.0.0",
75
+ "mpegts.js": "^1.0.0"
76
+ },
77
+ "peerDependenciesMeta": {
78
+ "vue": {
79
+ "optional": true
80
+ },
81
+ "react": {
82
+ "optional": true
83
+ },
84
+ "react-dom": {
85
+ "optional": true
86
+ },
87
+ "hls.js": {
88
+ "optional": true
89
+ },
90
+ "flv.js": {
91
+ "optional": true
92
+ },
93
+ "mpegts.js": {
94
+ "optional": true
95
+ }
96
+ },
97
+ "devDependencies": {
98
+ "@types/react": "^19.0.0",
99
+ "esbuild": "^0.25.0",
100
+ "react": "^19.0.0",
101
+ "react-dom": "^19.0.0",
102
+ "vue": "^3.5.0"
103
+ },
104
+ "publishConfig": {
105
+ "access": "public"
106
+ },
107
+ "engines": {
108
+ "node": ">=16"
109
+ }
110
+ }
@@ -0,0 +1,61 @@
1
+ export interface CkplayerConfig {
2
+ /** 容器选择器、DOM 或组件内部节点 */
3
+ container?: string | HTMLElement;
4
+ /** 视频地址:mp4 / m3u8 / flv / ts,或清晰度数组 */
5
+ video?: string | any[] | object;
6
+ poster?: string;
7
+ autoplay?: boolean;
8
+ loop?: boolean;
9
+ live?: boolean | number;
10
+ volume?: number;
11
+ /**
12
+ * 流媒体插件。一般无需填写:默认 autoPlug=true 时按地址自动选择。
13
+ * 可选:'hls.js' | 'flv.js' | 'mpegts.js' | 自定义 function
14
+ */
15
+ plug?: string | ((video: any, url: string) => void);
16
+ /**
17
+ * 是否根据地址自动设置 plug,默认 true。
18
+ * mp4 → 不加载插件;m3u8 → hls.js;flv → flv.js;ts → mpegts.js
19
+ */
20
+ autoPlug?: boolean;
21
+ /**
22
+ * 插件与语言包根路径(需含 hls.js/、flv.js/ 等子目录)。
23
+ * 一般无需配置:会优先用 window.ckplayerBasePath,否则回退到本包 jsDelivr CDN。
24
+ */
25
+ pluginPath?: string;
26
+ language?: string;
27
+ seek?: number | string;
28
+ crossOrigin?: string;
29
+ cookie?: string | object | any[];
30
+ /** 仅支持函数;字符串形式已禁用 */
31
+ loaded?: (player: CkplayerInstance) => void;
32
+ [key: string]: any;
33
+ }
34
+
35
+ export interface CkplayerInstance {
36
+ play(fn?: (...args: any[]) => void): any;
37
+ pause(fn?: (...args: any[]) => void): any;
38
+ seek(time: number, fn?: (...args: any[]) => void): any;
39
+ volume(vol?: number | ((vol: number) => void)): any;
40
+ muted(fn?: (state: boolean) => void): any;
41
+ exitMuted(): any;
42
+ full(fn?: (state: boolean) => void): any;
43
+ webFull(): any;
44
+ theatre(): any;
45
+ exitTheatre(): any;
46
+ ended(fn?: (...args: any[]) => void): any;
47
+ time(fn?: (t: number) => void): any;
48
+ error(fn?: (err: any) => void): any;
49
+ remove(): null;
50
+ [key: string]: any;
51
+ }
52
+
53
+ declare function ckplayer(config: CkplayerConfig): CkplayerInstance;
54
+ declare class ckplayer {
55
+ constructor(config: CkplayerConfig);
56
+ }
57
+
58
+ export declare function guessPlug(url: string): '' | 'hls.js' | 'flv.js' | 'mpegts.js';
59
+
60
+ export default ckplayer;
61
+ export { ckplayer };
@@ -0,0 +1,48 @@
1
+ import type { CSSProperties, ForwardRefExoticComponent, RefAttributes } from 'react';
2
+ import type { CkplayerConfig, CkplayerInstance } from './index';
3
+
4
+ export interface CkPlayerProps {
5
+ video: CkplayerConfig['video'];
6
+ poster?: string;
7
+ autoplay?: boolean;
8
+ live?: boolean | number;
9
+ /** 一般不用传,默认按地址自动识别 */
10
+ plug?: string;
11
+ /** 默认 true */
12
+ autoPlug?: boolean;
13
+ volume?: number;
14
+ pluginPath?: string;
15
+ options?: Partial<CkplayerConfig>;
16
+ width?: string | number;
17
+ height?: string | number;
18
+ className?: string;
19
+ style?: CSSProperties;
20
+ onReady?: (player: CkplayerInstance) => void;
21
+ onPlay?: (...args: any[]) => void;
22
+ onPause?: (...args: any[]) => void;
23
+ onEnded?: (...args: any[]) => void;
24
+ onVolume?: (vol: number) => void;
25
+ onMuted?: (state: boolean) => void;
26
+ onFull?: (state: boolean) => void;
27
+ onError?: (err: any) => void;
28
+ onTime?: (t: number) => void;
29
+ onSeek?: (...args: any[]) => void;
30
+ onScreenshot?: (...args: any[]) => void;
31
+ }
32
+
33
+ export interface CkPlayerRef {
34
+ play(): void;
35
+ pause(): void;
36
+ seek(time: number): void;
37
+ setVolume(vol: number): void;
38
+ muted(): void;
39
+ exitMuted(): void;
40
+ full(): void;
41
+ remove(): void;
42
+ getPlayer(): CkplayerInstance | null;
43
+ }
44
+
45
+ declare const CkPlayer: ForwardRefExoticComponent<CkPlayerProps & RefAttributes<CkPlayerRef>>;
46
+
47
+ export default CkPlayer;
48
+ export { CkPlayer };
package/types/vue.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ import type { CkplayerConfig, CkplayerInstance } from './index';
2
+
3
+ export interface CkPlayerProps {
4
+ video: CkplayerConfig['video'];
5
+ poster?: string;
6
+ autoplay?: boolean;
7
+ live?: boolean | number;
8
+ /** 一般不用传,默认按地址自动识别 */
9
+ plug?: string;
10
+ /** 默认 true */
11
+ autoPlug?: boolean;
12
+ volume?: number;
13
+ pluginPath?: string;
14
+ options?: Partial<CkplayerConfig>;
15
+ width?: string;
16
+ height?: string;
17
+ className?: string;
18
+ }
19
+
20
+ declare const CkPlayer: {
21
+ name: string;
22
+ props: Record<string, any>;
23
+ methods: {
24
+ play(): void;
25
+ pause(): void;
26
+ seek(time: number): void;
27
+ setVolume(vol: number): void;
28
+ muted(): void;
29
+ exitMuted(): void;
30
+ full(): void;
31
+ remove(): void;
32
+ getPlayer(): CkplayerInstance | null;
33
+ };
34
+ };
35
+
36
+ export default CkPlayer;
37
+ export { CkPlayer };
38
+ export type { CkPlayerProps };