@vanwei-wcs/video-player-v3 0.1.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.
@@ -0,0 +1,151 @@
1
+ /**
2
+ * 视频状态枚举
3
+ */
4
+ export declare const VideoStatus: {
5
+ readonly vConnect: 0
6
+ readonly vStart: 1
7
+ readonly vPlay: 2
8
+ readonly vPause: 3
9
+ readonly vStop: 4
10
+ }
11
+ export type VideoStatusType = typeof VideoStatus[keyof typeof VideoStatus]
12
+
13
+ /**
14
+ * 播放器配置
15
+ */
16
+ export interface PlayerOptions {
17
+ debug: boolean
18
+ mode: 'video' | 'audio'
19
+ baseLibPath: string
20
+ decoderLogLevel?: number
21
+ }
22
+
23
+ /**
24
+ * 媒体信息
25
+ */
26
+ export interface MediaInfo {
27
+ format: 'H264' | 'H265'
28
+ width: number
29
+ height: number
30
+ mode?: string
31
+ }
32
+
33
+ /**
34
+ * 流信息
35
+ */
36
+ export interface StreamInfo {
37
+ speed: number
38
+ fps: number
39
+ }
40
+
41
+ /**
42
+ * 视频配置
43
+ */
44
+ export interface VideoConfig {
45
+ url: string
46
+ token?: string
47
+ }
48
+
49
+ /**
50
+ * 云台方向
51
+ */
52
+ export type PTZDirection =
53
+ | 'tilt_up'
54
+ | 'up_right'
55
+ | 'pan_right'
56
+ | 'down_right'
57
+ | 'tilt_down'
58
+ | 'down_left'
59
+ | 'pan_left'
60
+ | 'up_left'
61
+
62
+ /**
63
+ * 云台变倍指令
64
+ */
65
+ export type PTZZoomCommand =
66
+ | 'zoom_in'
67
+ | 'zoom_out'
68
+ | 'focus_in'
69
+ | 'focus_out'
70
+ | 'iris_up'
71
+ | 'iris_down'
72
+
73
+ /**
74
+ * 云台命令
75
+ */
76
+ export type PTZCommand = PTZDirection | PTZZoomCommand | 'stop_all'
77
+
78
+ /**
79
+ * 视频质量 (0: 高清, 1: 标清, 2: 流畅)
80
+ */
81
+ export type VideoQuality = 0 | 1 | 2
82
+
83
+ /**
84
+ * 播放速度项
85
+ */
86
+ export interface SpeedItem {
87
+ label: string
88
+ value: number
89
+ }
90
+
91
+ /**
92
+ * 组件 Props
93
+ */
94
+ export interface VideoPlayerProps {
95
+ debug?: boolean
96
+ isLive?: boolean
97
+ options?: PlayerOptions
98
+ showPTZ?: boolean
99
+ showController?: boolean
100
+ }
101
+
102
+ /**
103
+ * WWAV Player 实例接口
104
+ */
105
+ export interface WWAVPlayerInstance {
106
+ on(event: string, callback: (...args: unknown[]) => void): void
107
+ onStream: ((info: { type: string; data: ArrayBuffer }) => void) | null
108
+ open(url: string, token?: string): void
109
+ openTalk(url: string, token?: string): void
110
+ closeTalk(): void
111
+ muted(muted: boolean): void
112
+ play(): void
113
+ pause(): void
114
+ close(): void
115
+ destroy(): Promise<void>
116
+ attachVideoElement(element: HTMLVideoElement, options?: PlayerOptions): void
117
+ attachCanvasElement(element: HTMLCanvasElement, options?: PlayerOptions): void
118
+ }
119
+
120
+ /**
121
+ * 视频播放器组件
122
+ */
123
+ export const WwVideoPlayer: {
124
+ new (): {
125
+ $props: VideoPlayerProps
126
+ $emit: {
127
+ (e: 'stop-video'): void
128
+ (e: 'quality-change', quality: VideoQuality): void
129
+ (e: 'change-play-speed', speed: number): void
130
+ (e: 'control-talk', status: boolean): void
131
+ (e: 'lock-ptz', status: boolean): void
132
+ (e: 'do-zoom', command: PTZZoomCommand): void
133
+ (e: 'move-to-direction', direction: PTZDirection): void
134
+ (e: 'error', error: Error): void
135
+ (e: 'video-status-change', status: number): void
136
+ }
137
+ }
138
+ openVideo(video: VideoConfig): Promise<void>
139
+ closeVideo(): Promise<void>
140
+ captureVideo(): void
141
+ changeQuality(quality: VideoQuality): void
142
+ }
143
+
144
+ /**
145
+ * 默认导出(支持全局注册)
146
+ */
147
+ declare const _default: {
148
+ install: (app: { component: (name: string, component: typeof WwVideoPlayer) => void }) => void
149
+ WwVideoPlayer: typeof WwVideoPlayer
150
+ }
151
+ export default _default