videojs-vue 0.0.1 → 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.
- package/README.md +41 -190
- package/dist/index-C0mUaTCA.d.ts +619 -0
- package/dist/index.d.ts +2 -130
- package/dist/index.js +284 -96
- package/dist/media/hls.d.ts +87 -0
- package/dist/media/hls.js +30 -0
- package/dist/ui/index.d.ts +263 -0
- package/dist/ui/index.js +99 -0
- package/dist/useMediaElement-xb_hFj5K.js +147 -0
- package/package.json +33 -130
- package/dist/AlertDialog-BPntemoC.js +0 -112
- package/dist/Audio-3HgRIaNt.js +0 -29
- package/dist/Audio-rV5KrK6q.d.ts +0 -7
- package/dist/BufferingIndicator-Crzitkyo.js +0 -64
- package/dist/CaptionsButton-DZvnZsRf.js +0 -124
- package/dist/CastButton-B645yeE0.js +0 -32
- package/dist/Controls-CEaWmHRW.js +0 -33
- package/dist/ErrorDialog-Csv288q6.js +0 -60
- package/dist/FullscreenButton-C29YwATz.js +0 -59
- package/dist/Gesture-DFE17PKp.js +0 -75
- package/dist/Hotkey-DbQF7Kcc.js +0 -72
- package/dist/MuteButton-DI9PgX0j.js +0 -47
- package/dist/PiPButton-Da-rW3zX.js +0 -55
- package/dist/PlayButton-D8BRNiiy.js +0 -51
- package/dist/PlaybackRateButton-BL6cly9Z.js +0 -60
- package/dist/Popover-BoMi7OiJ.js +0 -94
- package/dist/Poster-uAFVQvx8.js +0 -33
- package/dist/SeekButton-VPcC9jiz.js +0 -48
- package/dist/Slider-C8FCipIJ.js +0 -127
- package/dist/Thumbnail-D1iL13r4.js +0 -48
- package/dist/Time-pfGZovLG.js +0 -77
- package/dist/TimeSlider-dlcFBLwL.js +0 -147
- package/dist/Tooltip-DyEkP_xv.js +0 -119
- package/dist/Video-DZX6iEK6.d.ts +0 -7
- package/dist/Video-DtjXh6lt.js +0 -29
- package/dist/VolumeSlider-C_nTFP4G.js +0 -148
- package/dist/alert-dialog.d.ts +0 -2
- package/dist/alert-dialog.js +0 -2
- package/dist/audio.d.ts +0 -3
- package/dist/audio.js +0 -3
- package/dist/background.d.ts +0 -8
- package/dist/background.js +0 -19
- package/dist/buffering-indicator.d.ts +0 -2
- package/dist/buffering-indicator.js +0 -2
- package/dist/captions-button.d.ts +0 -2
- package/dist/captions-button.js +0 -2
- package/dist/cast-button.d.ts +0 -2
- package/dist/cast-button.js +0 -2
- package/dist/context-C48Uabdu.js +0 -83
- package/dist/controls.d.ts +0 -2
- package/dist/controls.js +0 -2
- package/dist/createParts-Cq1bDfQi.d.ts +0 -20
- package/dist/createParts-DQhQPfRO.js +0 -115
- package/dist/error-dialog.d.ts +0 -2
- package/dist/error-dialog.js +0 -2
- package/dist/formatClock-D8z33znG.js +0 -12
- package/dist/full-screen-button.d.ts +0 -2
- package/dist/full-screen-button.js +0 -2
- package/dist/gesture.d.ts +0 -2
- package/dist/gesture.js +0 -2
- package/dist/hotkey.d.ts +0 -2
- package/dist/hotkey.js +0 -2
- package/dist/index-B3CYxKTC.d.ts +0 -12
- package/dist/index-B6WjYRnz.d.ts +0 -33
- package/dist/index-BJwWXroQ.d.ts +0 -33
- package/dist/index-BQN2NnER.d.ts +0 -127
- package/dist/index-BfzCw_wH.d.ts +0 -71
- package/dist/index-Bt_p2vCi.d.ts +0 -176
- package/dist/index-Bx7oSSQd.d.ts +0 -33
- package/dist/index-C8DkRbnH.d.ts +0 -108
- package/dist/index-CSs1G8z6.d.ts +0 -7
- package/dist/index-CcKZD20a.d.ts +0 -90
- package/dist/index-Cp23VNuH.d.ts +0 -23
- package/dist/index-Cry-CeV9.d.ts +0 -57
- package/dist/index-D5lfnRsK.d.ts +0 -20
- package/dist/index-D8EBYIXG.d.ts +0 -38
- package/dist/index-DYxPIvnt.d.ts +0 -119
- package/dist/index-DrelWSL1.d.ts +0 -50
- package/dist/index-EsA6hZWc.d.ts +0 -23
- package/dist/index-RI8VZ21i.d.ts +0 -69
- package/dist/index-iTm4WaZf.d.ts +0 -33
- package/dist/index-lmsQv-dG.d.ts +0 -33
- package/dist/index-w4PLuacs.d.ts +0 -33
- package/dist/index-ygLHhQAa.d.ts +0 -7
- package/dist/live-audio.d.ts +0 -6
- package/dist/live-audio.js +0 -6
- package/dist/live-video.d.ts +0 -6
- package/dist/live-video.js +0 -6
- package/dist/mediaActions-Bhs90znv.js +0 -39
- package/dist/mute-button.d.ts +0 -2
- package/dist/mute-button.js +0 -2
- package/dist/pip-button.d.ts +0 -2
- package/dist/pip-button.js +0 -2
- package/dist/play-button.d.ts +0 -2
- package/dist/play-button.js +0 -2
- package/dist/playback-rate-button.d.ts +0 -2
- package/dist/playback-rate-button.js +0 -2
- package/dist/popover.d.ts +0 -2
- package/dist/popover.js +0 -2
- package/dist/poster.d.ts +0 -2
- package/dist/poster.js +0 -2
- package/dist/renderElement-D_UbvLk5.js +0 -114
- package/dist/seek-button.d.ts +0 -2
- package/dist/seek-button.js +0 -2
- package/dist/slider.d.ts +0 -3
- package/dist/slider.js +0 -2
- package/dist/thumbnail.d.ts +0 -2
- package/dist/thumbnail.js +0 -2
- package/dist/time-slider.d.ts +0 -3
- package/dist/time-slider.js +0 -2
- package/dist/time.d.ts +0 -2
- package/dist/time.js +0 -2
- package/dist/tooltip.d.ts +0 -2
- package/dist/tooltip.js +0 -2
- package/dist/useMediaEvents-Br7vzJ_l.js +0 -17
- package/dist/useSyncMediaProps-C7F52G6b.js +0 -95
- package/dist/video.d.ts +0 -3
- package/dist/video.js +0 -3
- package/dist/volume-slider.d.ts +0 -3
- package/dist/volume-slider.js +0 -2
package/README.md
CHANGED
|
@@ -1,208 +1,59 @@
|
|
|
1
1
|
# videojs-vue
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://www.npmjs.com/package/videojs-vue)
|
|
5
|
-
[](https://www.npmjs.com/package/videojs-vue)
|
|
6
|
-
[](https://github.com/ntnyq/videojs-vue/blob/main/LICENSE)
|
|
3
|
+
Vue 3 components and composables for Video.js 10. Start with a complete player, then compose your own interface using the same upstream store and media capabilities.
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
```sh
|
|
6
|
+
pnpm add videojs-vue vue
|
|
7
|
+
```
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
```vue
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { VideoPlayer } from 'videojs-vue'
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<VideoPlayer
|
|
16
|
+
src="/demo.mp4"
|
|
17
|
+
poster="/poster.webp"
|
|
18
|
+
title="Demo"
|
|
19
|
+
/>
|
|
20
|
+
</template>
|
|
21
|
+
```
|
|
12
22
|
|
|
13
|
-
|
|
23
|
+
No `isCustomElement` configuration is needed when using the Vue components. Registration and packaged skin styles are included. Vue 3.5+ is required.
|
|
14
24
|
|
|
15
|
-
|
|
16
|
-
pnpm add videojs-vue
|
|
17
|
-
```
|
|
25
|
+
## Entry points
|
|
18
26
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
| Import | Purpose |
|
|
28
|
+
| ----------------------- | -------------------------------------------------------------- |
|
|
29
|
+
| `videojs-vue` | `VideoPlayer`, `PlayerRoot`, `Video`, skins, state and actions |
|
|
30
|
+
| `videojs-vue/media/hls` | Optional `HlsVideo` adapter and HLS source types |
|
|
31
|
+
| `videojs-vue/ui` | Composable upstream controls and layout components |
|
|
22
32
|
|
|
23
|
-
|
|
24
|
-
yarn add videojs-vue
|
|
25
|
-
```
|
|
33
|
+
For HLS, install `@videojs/hlsjs-video@10.0.1` and pass `HlsVideo` to the `media` prop. The basic entry does not import hls.js.
|
|
26
34
|
|
|
27
|
-
|
|
35
|
+
See [getting started](docs/guide/getting-started.md), [API contracts](docs/api/overview.md), [composition](docs/guide/composition.md), and [lifecycle / SSR](docs/guide/lifecycle.md).
|
|
28
36
|
|
|
29
|
-
|
|
37
|
+
## Workspace
|
|
30
38
|
|
|
31
|
-
|
|
32
|
-
import { createPlayer } from 'videojs-vue'
|
|
33
|
-
import { Video, videoFeatures } from 'videojs-vue/video'
|
|
39
|
+
The root is the publishable package. Both `playground` and `docs` are private pnpm workspace packages consuming `videojs-vue` through `workspace:*`. Docs use VitePress **2.0.0-alpha.20** (the current v2 prerelease).
|
|
34
40
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
```sh
|
|
42
|
+
pnpm install
|
|
43
|
+
pnpm build
|
|
44
|
+
pnpm play:dev # localhost:5174
|
|
45
|
+
pnpm docs:dev # localhost:5173
|
|
46
|
+
pnpm release:check # format, lint, types, tests, package and both sites
|
|
39
47
|
```
|
|
40
48
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export default defineComponent({
|
|
47
|
-
setup() {
|
|
48
|
-
const paused = Player.usePlayer(state => state.paused)
|
|
49
|
-
const store = Player.usePlayer()
|
|
50
|
-
|
|
51
|
-
return () =>
|
|
52
|
-
h(Player.Provider, () =>
|
|
53
|
-
h(Player.Container, { class: 'player-shell' }, () => [
|
|
54
|
-
h(Video, {
|
|
55
|
-
src: 'https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4',
|
|
56
|
-
playsInline: true,
|
|
57
|
-
}),
|
|
58
|
-
h(
|
|
59
|
-
'button',
|
|
60
|
-
{
|
|
61
|
-
type: 'button',
|
|
62
|
-
onClick: () => (paused.value ? store.play() : store.pause()),
|
|
63
|
-
},
|
|
64
|
-
paused.value ? 'Play' : 'Pause',
|
|
65
|
-
),
|
|
66
|
-
]),
|
|
67
|
-
)
|
|
68
|
-
},
|
|
69
|
-
})
|
|
70
|
-
```
|
|
49
|
+
Run `pnpm dev` in another terminal while changing library source. Both sites consume the built package. See [playground scenarios](docs/playground.md).
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This version focuses on on-demand native video and HLS. Packaged default/neutral skins and a small set of upstream control bindings share one player store. It does not recreate Video.js internals, maintain a second playback state machine, or introduce a plugin framework. Audio, dedicated live presets, YouTube/Mux adapters and persistence remain future work.
|
|
71
54
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
### Root exports
|
|
75
|
-
|
|
76
|
-
- `createPlayer(config)` returns:
|
|
77
|
-
- `Provider`
|
|
78
|
-
- `Container`
|
|
79
|
-
- `usePlayer()`
|
|
80
|
-
- `useMedia()`
|
|
81
|
-
- `createPlayer({ plugins })` supports runtime extension hooks:
|
|
82
|
-
- `onProviderSetup(context)`
|
|
83
|
-
- `onAttach(context)`
|
|
84
|
-
- `onDetach(context)`
|
|
85
|
-
- `onProviderDestroy(context)`
|
|
86
|
-
- `usePlayer(selector)` returns a readonly `ref`, which is the Vue equivalent of the React hook's reactive selected value.
|
|
87
|
-
- `useOptionalPlayer()`, `useContainer()`, `useMediaAttach()` and `useContainerAttach()` are also exported for lower-level integrations.
|
|
88
|
-
- Utility exports:
|
|
89
|
-
- `mergeProps(...props)`
|
|
90
|
-
- `renderElement(tag, componentProps, params)`
|
|
91
|
-
|
|
92
|
-
### Preset entry points
|
|
93
|
-
|
|
94
|
-
- `videojs-vue/video`
|
|
95
|
-
- `Video`
|
|
96
|
-
- `videoFeatures`
|
|
97
|
-
- `videojs-vue/audio`
|
|
98
|
-
- `Audio`
|
|
99
|
-
- `audioFeatures`
|
|
100
|
-
- `videojs-vue/background`
|
|
101
|
-
- `BackgroundVideo`
|
|
102
|
-
- `backgroundFeatures`
|
|
103
|
-
- `videojs-vue/live-video`
|
|
104
|
-
- `Video`
|
|
105
|
-
- `liveVideoFeatures`
|
|
106
|
-
- `videojs-vue/live-audio`
|
|
107
|
-
- `Audio`
|
|
108
|
-
- `liveAudioFeatures`
|
|
109
|
-
|
|
110
|
-
### UI entry points
|
|
111
|
-
|
|
112
|
-
- `videojs-vue/full-screen-button` (or `videojs-vue/fullscreen-button`)
|
|
113
|
-
- `FullscreenButton`
|
|
114
|
-
- `videojs-vue/playback-rate-button`
|
|
115
|
-
- `PlaybackRateButton`
|
|
116
|
-
- `videojs-vue/poster`
|
|
117
|
-
- `Poster`
|
|
118
|
-
- `videojs-vue/time`
|
|
119
|
-
- `Time.Group`
|
|
120
|
-
- `Time.Separator`
|
|
121
|
-
- `Time.Value`
|
|
122
|
-
- `videojs-vue/play-button`
|
|
123
|
-
- `PlayButton`
|
|
124
|
-
- `videojs-vue/mute-button`
|
|
125
|
-
- `MuteButton`
|
|
126
|
-
- `videojs-vue/pip-button`
|
|
127
|
-
- `PiPButton`
|
|
128
|
-
- `videojs-vue/seek-button`
|
|
129
|
-
- `SeekButton`
|
|
130
|
-
- `videojs-vue/volume-slider`
|
|
131
|
-
- `VolumeSlider.Root`
|
|
132
|
-
- `VolumeSlider.Track`
|
|
133
|
-
- `VolumeSlider.Fill`
|
|
134
|
-
- `VolumeSlider.Thumb`
|
|
135
|
-
- `VolumeSlider.Value`
|
|
136
|
-
- `VolumeSlider.Preview`
|
|
137
|
-
- `videojs-vue/time-slider`
|
|
138
|
-
- `TimeSlider.Root`
|
|
139
|
-
- `TimeSlider.Track`
|
|
140
|
-
- `TimeSlider.Buffer`
|
|
141
|
-
- `TimeSlider.Fill`
|
|
142
|
-
- `TimeSlider.Thumb`
|
|
143
|
-
- `TimeSlider.Value`
|
|
144
|
-
- `TimeSlider.Preview`
|
|
145
|
-
- `videojs-vue/controls`
|
|
146
|
-
- `Controls.Root`
|
|
147
|
-
- `Controls.Group`
|
|
148
|
-
- `videojs-vue/tooltip`
|
|
149
|
-
- `Tooltip.Provider`
|
|
150
|
-
- `Tooltip.Root`
|
|
151
|
-
- `Tooltip.Trigger`
|
|
152
|
-
- `Tooltip.Popup`
|
|
153
|
-
- `Tooltip.Arrow`
|
|
154
|
-
- `videojs-vue/popover`
|
|
155
|
-
- `Popover.Root`
|
|
156
|
-
- `Popover.Trigger`
|
|
157
|
-
- `Popover.Popup`
|
|
158
|
-
- `Popover.Arrow`
|
|
159
|
-
- `videojs-vue/captions-button`
|
|
160
|
-
- `CaptionsButton`
|
|
161
|
-
- `videojs-vue/cast-button`
|
|
162
|
-
- `CastButton`
|
|
163
|
-
- `videojs-vue/buffering-indicator`
|
|
164
|
-
- `BufferingIndicator`
|
|
165
|
-
- `videojs-vue/alert-dialog`
|
|
166
|
-
- `AlertDialog.Root`
|
|
167
|
-
- `AlertDialog.Popup`
|
|
168
|
-
- `AlertDialog.Title`
|
|
169
|
-
- `AlertDialog.Description`
|
|
170
|
-
- `AlertDialog.Close`
|
|
171
|
-
- `videojs-vue/error-dialog`
|
|
172
|
-
- `ErrorDialog.Root`
|
|
173
|
-
- `ErrorDialog.Popup`
|
|
174
|
-
- `ErrorDialog.Title`
|
|
175
|
-
- `ErrorDialog.Description`
|
|
176
|
-
- `ErrorDialog.Close`
|
|
177
|
-
- `videojs-vue/hotkey`
|
|
178
|
-
- `Hotkey`
|
|
179
|
-
- `videojs-vue/gesture`
|
|
180
|
-
- `Gesture`
|
|
181
|
-
- `videojs-vue/thumbnail`
|
|
182
|
-
- `Thumbnail`
|
|
183
|
-
- `videojs-vue/slider`
|
|
184
|
-
- `Slider.Root`
|
|
185
|
-
- `Slider.Track`
|
|
186
|
-
- `Slider.Buffer`
|
|
187
|
-
- `Slider.Fill`
|
|
188
|
-
- `Slider.Thumb`
|
|
189
|
-
- `Slider.Value`
|
|
190
|
-
- `Slider.Preview`
|
|
191
|
-
- `Slider.Thumbnail`
|
|
192
|
-
|
|
193
|
-
## Notes
|
|
194
|
-
|
|
195
|
-
- `Provider` owns the Video.js store instance and reattaches it whenever the media element or container changes.
|
|
196
|
-
- `Container` keeps the same focus behavior as the React implementation: on pointer release it focuses itself when nothing inside already has focus, so keyboard shortcuts can work reliably.
|
|
197
|
-
- Media components use native `<video>` / `<audio>` elements, register themselves automatically through provide/inject, and reactively sync key media props (`src`, `poster`, `autoplay`, `controls`, `loop`, `muted`, `playsInline`, `preload`, `crossOrigin`, `volume`, `playbackRate`).
|
|
198
|
-
- Captions button now uses reactive track state and auto-disables when no caption/subtitle tracks are available.
|
|
199
|
-
|
|
200
|
-
## Migration (Current Beta)
|
|
201
|
-
|
|
202
|
-
- UI button primitives now use unified internal prop-merging behavior (`mergeProps`) instead of per-component manual click chaining.
|
|
203
|
-
- External event handlers still run before internal handlers and can cancel internal behavior via `event.preventDefault()`.
|
|
204
|
-
- Prefer `playsInline` over lowercase `playsinline` in JSX/templates.
|
|
55
|
+
The previous provider/controller API and experimental component entrypoints have been removed. Migrate to `VideoPlayer` or `PlayerRoot` and the two composables described in the docs.
|
|
205
56
|
|
|
206
57
|
## License
|
|
207
58
|
|
|
208
|
-
[MIT](
|
|
59
|
+
[MIT](LICENSE)
|