videojs-vue 0.1.0 → 0.3.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.
Files changed (212) hide show
  1. package/README.md +34 -24
  2. package/dist/audio/Audio.d.ts +69 -0
  3. package/dist/audio/Audio.js +21 -0
  4. package/dist/audio/AudioPlayer.d.ts +948 -0
  5. package/dist/audio/AudioPlayer.js +10 -0
  6. package/dist/audio/AudioPlayerRoot.d.ts +109 -0
  7. package/dist/audio/AudioPlayerRoot.js +43 -0
  8. package/dist/audio/composables.d.ts +18 -0
  9. package/dist/audio/composables.js +31 -0
  10. package/dist/audio/core.d.ts +7 -0
  11. package/dist/audio/core.js +3 -0
  12. package/dist/audio/createAudioPlayer.d.ts +954 -0
  13. package/dist/audio/createAudioPlayer.js +76 -0
  14. package/dist/audio/default.d.ts +948 -0
  15. package/dist/audio/default.js +6 -0
  16. package/dist/audio/index.d.ts +16 -0
  17. package/dist/audio/index.js +10 -0
  18. package/dist/audio/neutral.d.ts +948 -0
  19. package/dist/audio/neutral.js +6 -0
  20. package/dist/audio/skins/createAudioSkin.d.ts +5 -0
  21. package/dist/audio/skins/createAudioSkin.js +20 -0
  22. package/dist/audio/skins/default.d.ts +6 -0
  23. package/dist/audio/skins/default.js +6 -0
  24. package/dist/audio/skins/neutral.d.ts +6 -0
  25. package/dist/audio/skins/neutral.js +6 -0
  26. package/dist/audio/skins.d.ts +3 -0
  27. package/dist/audio/skins.js +3 -0
  28. package/dist/audio/types.d.ts +22 -0
  29. package/dist/audio/types.js +0 -0
  30. package/dist/composables/index.d.ts +4 -0
  31. package/dist/composables/index.js +3 -0
  32. package/dist/composables/usePlayerActions.d.ts +9 -0
  33. package/dist/composables/usePlayerActions.js +17 -0
  34. package/dist/composables/usePlayerState.d.ts +12 -0
  35. package/dist/composables/usePlayerState.js +19 -0
  36. package/dist/composables/useStoreSelection.d.ts +9 -0
  37. package/dist/composables/useStoreSelection.js +19 -0
  38. package/dist/core/index.d.ts +7 -0
  39. package/dist/core/index.js +3 -0
  40. package/dist/i18n/MediaI18n.d.ts +16 -0
  41. package/dist/i18n/MediaI18n.js +26 -0
  42. package/dist/i18n/MediaText.d.ts +14 -0
  43. package/dist/i18n/MediaText.js +37 -0
  44. package/dist/i18n/index.d.ts +4 -0
  45. package/dist/i18n/index.js +4 -0
  46. package/dist/index.d.ts +16 -1
  47. package/dist/index.js +10 -290
  48. package/dist/media/Video.d.ts +79 -0
  49. package/dist/media/Video.js +21 -0
  50. package/dist/media/events.d.ts +5 -0
  51. package/dist/media/events.js +30 -0
  52. package/dist/media/hls.d.ts +12 -12
  53. package/dist/media/hls.js +3 -1
  54. package/dist/media/props.d.ts +45 -0
  55. package/dist/media/props.js +28 -0
  56. package/dist/media/types.d.ts +23 -0
  57. package/dist/media/types.js +0 -0
  58. package/dist/media/useMediaElement.d.ts +18 -0
  59. package/dist/media/useMediaElement.js +91 -0
  60. package/dist/node_modules/.pnpm/@vue_reactivity@3.5.43/node_modules/@vue/reactivity/dist/reactivity.d.ts +3 -0
  61. package/dist/player/PlayerRoot.d.ts +109 -0
  62. package/dist/player/PlayerRoot.js +43 -0
  63. package/dist/player/actions.d.ts +17 -0
  64. package/dist/player/actions.js +59 -0
  65. package/dist/player/context.d.ts +18 -0
  66. package/dist/player/context.js +16 -0
  67. package/dist/player/events.d.ts +32 -0
  68. package/dist/player/events.js +13 -0
  69. package/dist/player/preservePlayerTree.d.ts +8 -0
  70. package/dist/player/preservePlayerTree.js +64 -0
  71. package/dist/player/types.d.ts +22 -0
  72. package/dist/player/types.js +0 -0
  73. package/dist/player/usePlayerRoot.d.ts +32 -0
  74. package/dist/player/usePlayerRoot.js +89 -0
  75. package/dist/polyfills.d.ts +2 -0
  76. package/dist/polyfills.js +2 -0
  77. package/dist/register/audio/neutral-skin.d.ts +1 -0
  78. package/dist/register/audio/neutral-skin.js +1 -0
  79. package/dist/register/audio/player.d.ts +1 -0
  80. package/dist/register/audio/player.js +1 -0
  81. package/dist/register/audio/skin.d.ts +1 -0
  82. package/dist/register/audio/skin.js +1 -0
  83. package/dist/register/i18n.d.ts +1 -0
  84. package/dist/register/i18n.js +1 -0
  85. package/dist/register/ui/captions-button.d.ts +1 -0
  86. package/dist/register/ui/captions-button.js +1 -0
  87. package/dist/register/ui/container.d.ts +1 -0
  88. package/dist/register/ui/container.js +1 -0
  89. package/dist/register/ui/controls-content.d.ts +1 -0
  90. package/dist/register/ui/controls-content.js +1 -0
  91. package/dist/register/ui/controls-group.d.ts +1 -0
  92. package/dist/register/ui/controls-group.js +1 -0
  93. package/dist/register/ui/controls.d.ts +1 -0
  94. package/dist/register/ui/controls.js +1 -0
  95. package/dist/register/ui/fullscreen-button.d.ts +1 -0
  96. package/dist/register/ui/fullscreen-button.js +1 -0
  97. package/dist/register/ui/hotkey.d.ts +1 -0
  98. package/dist/register/ui/hotkey.js +1 -0
  99. package/dist/register/ui/mute-button.d.ts +1 -0
  100. package/dist/register/ui/mute-button.js +1 -0
  101. package/dist/register/ui/pip-button.d.ts +1 -0
  102. package/dist/register/ui/pip-button.js +1 -0
  103. package/dist/register/ui/play-button.d.ts +1 -0
  104. package/dist/register/ui/play-button.js +1 -0
  105. package/dist/register/ui/poster.d.ts +1 -0
  106. package/dist/register/ui/poster.js +1 -0
  107. package/dist/register/ui/seek-button.d.ts +1 -0
  108. package/dist/register/ui/seek-button.js +1 -0
  109. package/dist/register/ui/slider-buffer.d.ts +1 -0
  110. package/dist/register/ui/slider-buffer.js +1 -0
  111. package/dist/register/ui/slider-fill.d.ts +1 -0
  112. package/dist/register/ui/slider-fill.js +1 -0
  113. package/dist/register/ui/slider-thumb.d.ts +1 -0
  114. package/dist/register/ui/slider-thumb.js +1 -0
  115. package/dist/register/ui/slider-track.d.ts +1 -0
  116. package/dist/register/ui/slider-track.js +1 -0
  117. package/dist/register/ui/status-announcer.d.ts +1 -0
  118. package/dist/register/ui/status-announcer.js +1 -0
  119. package/dist/register/ui/time-slider.d.ts +1 -0
  120. package/dist/register/ui/time-slider.js +1 -0
  121. package/dist/register/ui/time.d.ts +1 -0
  122. package/dist/register/ui/time.js +1 -0
  123. package/dist/register/ui/volume-slider.d.ts +1 -0
  124. package/dist/register/ui/volume-slider.js +1 -0
  125. package/dist/register/video/compat-skin.d.ts +1 -0
  126. package/dist/register/video/compat-skin.js +1 -0
  127. package/dist/register/video/neutral-skin.d.ts +1 -0
  128. package/dist/register/video/neutral-skin.js +1 -0
  129. package/dist/register/video/player.d.ts +1 -0
  130. package/dist/register/video/player.js +1 -0
  131. package/dist/register/video/skin.d.ts +1 -0
  132. package/dist/register/video/skin.js +1 -0
  133. package/dist/skins/compat.d.ts +6 -0
  134. package/dist/skins/compat.js +6 -0
  135. package/dist/skins/createVideoSkin.d.ts +5 -0
  136. package/dist/skins/createVideoSkin.js +25 -0
  137. package/dist/skins/default.d.ts +6 -0
  138. package/dist/skins/default.js +6 -0
  139. package/dist/skins/index.d.ts +3 -0
  140. package/dist/skins/index.js +3 -0
  141. package/dist/skins/legacy/LegacyControls.d.ts +8 -0
  142. package/dist/skins/legacy/LegacyControls.js +89 -0
  143. package/dist/skins/legacy/useLegacySize.d.ts +9 -0
  144. package/dist/skins/legacy/useLegacySize.js +32 -0
  145. package/dist/skins/legacy.css +160 -0
  146. package/dist/skins/legacy.d.ts +6 -0
  147. package/dist/skins/legacy.js +36 -0
  148. package/dist/skins/neutral.d.ts +6 -0
  149. package/dist/skins/neutral.js +6 -0
  150. package/dist/skins/withSlot.d.ts +10 -0
  151. package/dist/skins/withSlot.js +16 -0
  152. package/dist/ui/captions-button.d.ts +20 -0
  153. package/dist/ui/captions-button.js +7 -0
  154. package/dist/ui/container.d.ts +6 -0
  155. package/dist/ui/container.js +6 -0
  156. package/dist/ui/controls-content.d.ts +6 -0
  157. package/dist/ui/controls-content.js +6 -0
  158. package/dist/ui/controls-group.d.ts +6 -0
  159. package/dist/ui/controls-group.js +6 -0
  160. package/dist/ui/controls.d.ts +12 -0
  161. package/dist/ui/controls.js +6 -0
  162. package/dist/ui/createElementComponent.d.ts +10 -0
  163. package/dist/ui/createElementComponent.js +28 -0
  164. package/dist/ui/fullscreen-button.d.ts +20 -0
  165. package/dist/ui/fullscreen-button.js +7 -0
  166. package/dist/ui/hotkey.d.ts +28 -0
  167. package/dist/ui/hotkey.js +13 -0
  168. package/dist/ui/index.d.ts +41 -263
  169. package/dist/ui/index.js +40 -98
  170. package/dist/ui/mute-button.d.ts +20 -0
  171. package/dist/ui/mute-button.js +7 -0
  172. package/dist/ui/pip-button.d.ts +20 -0
  173. package/dist/ui/pip-button.js +7 -0
  174. package/dist/ui/play-button.d.ts +20 -0
  175. package/dist/ui/play-button.js +7 -0
  176. package/dist/ui/poster.d.ts +6 -0
  177. package/dist/ui/poster.js +6 -0
  178. package/dist/ui/props.d.ts +25 -0
  179. package/dist/ui/props.js +17 -0
  180. package/dist/ui/seek-button.d.ts +22 -0
  181. package/dist/ui/seek-button.js +10 -0
  182. package/dist/ui/slider-buffer.d.ts +6 -0
  183. package/dist/ui/slider-buffer.js +6 -0
  184. package/dist/ui/slider-fill.d.ts +6 -0
  185. package/dist/ui/slider-fill.js +6 -0
  186. package/dist/ui/slider-thumb.d.ts +6 -0
  187. package/dist/ui/slider-thumb.js +6 -0
  188. package/dist/ui/slider-track.d.ts +6 -0
  189. package/dist/ui/slider-track.js +6 -0
  190. package/dist/ui/status-announcer.d.ts +6 -0
  191. package/dist/ui/status-announcer.js +6 -0
  192. package/dist/ui/time-slider.d.ts +37 -0
  193. package/dist/ui/time-slider.js +11 -0
  194. package/dist/ui/time.d.ts +26 -0
  195. package/dist/ui/time.js +12 -0
  196. package/dist/ui/volume-slider.d.ts +26 -0
  197. package/dist/ui/volume-slider.js +7 -0
  198. package/dist/video/VideoPlayer.d.ts +1068 -0
  199. package/dist/video/VideoPlayer.js +10 -0
  200. package/dist/video/compat.d.ts +1068 -0
  201. package/dist/video/compat.js +6 -0
  202. package/dist/video/createVideoPlayer.d.ts +1076 -0
  203. package/dist/video/createVideoPlayer.js +78 -0
  204. package/dist/video/default.d.ts +1068 -0
  205. package/dist/video/default.js +6 -0
  206. package/dist/video/legacy.d.ts +1068 -0
  207. package/dist/video/legacy.js +6 -0
  208. package/dist/video/neutral.d.ts +1068 -0
  209. package/dist/video/neutral.js +6 -0
  210. package/package.json +191 -7
  211. package/dist/index-C0mUaTCA.d.ts +0 -619
  212. package/dist/useMediaElement-xb_hFj5K.js +0 -147
package/README.md CHANGED
@@ -1,14 +1,27 @@
1
1
  # videojs-vue
2
2
 
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.
3
+ [![CI](https://github.com/ntnyq/videojs-vue/workflows/CI/badge.svg)](https://github.com/ntnyq/videojs-vue/actions)
4
+ [![NPM VERSION](https://img.shields.io/npm/v/videojs-vue.svg)](https://www.npmjs.com/package/videojs-vue)
5
+ [![NPM DOWNLOADS](https://img.shields.io/npm/dy/videojs-vue.svg)](https://www.npmjs.com/package/videojs-vue)
6
+ [![LICENSE](https://img.shields.io/github/license/ntnyq/videojs-vue.svg)](https://github.com/ntnyq/videojs-vue/blob/main/LICENSE)
7
+
8
+ Vue 3 components and composables for Video.js 10, with video and audio players, packaged skins, reactive playback state, and optional HLS support.
9
+
10
+ [Documentation](https://videojs-vue-docs.vercel.app) · [Playground](https://videojs-vue-playground.vercel.app)
11
+
12
+ ## Installation
13
+
14
+ Requires Vue 3.5 or later.
4
15
 
5
16
  ```sh
6
17
  pnpm add videojs-vue vue
7
18
  ```
8
19
 
20
+ ## Usage
21
+
9
22
  ```vue
10
23
  <script setup lang="ts">
11
- import { VideoPlayer } from 'videojs-vue'
24
+ import { VideoPlayer } from 'videojs-vue/video/default'
12
25
  </script>
13
26
 
14
27
  <template>
@@ -20,39 +33,36 @@ import { VideoPlayer } from 'videojs-vue'
20
33
  </template>
21
34
  ```
22
35
 
23
- No `isCustomElement` configuration is needed when using the Vue components. Registration and packaged skin styles are included. Vue 3.5+ is required.
36
+ Serve your video and poster at the URLs above. Component registration and skin styles are included; no Vue `isCustomElement` configuration is needed.
24
37
 
25
- ## Entry points
38
+ To use the upstream Compat skin, change the import to `videojs-vue/video/compat`. This entry loads only that skin and keeps the same player API. It does not include polyfills or guarantee a lower minimum browser version; see [Compat skin](https://videojs-vue-docs.vercel.app/guide/styling#compat-skin).
26
39
 
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 |
40
+ For Chrome 90+, use `videojs-vue/video/legacy` with `videojs-vue/skins/legacy.css`, opt-in `videojs-vue/polyfills`, and a consumer build targeting `chrome90`. See [legacy mode](https://videojs-vue-docs.vercel.app/guide/legacy) for setup and validation limits.
32
41
 
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.
42
+ `core-js` is an optional peer dependency. Install it with `pnpm add core-js@^3.50.0` before importing `videojs-vue/polyfills`. Other entries do not require it. If your target browsers or application already provide `Array.prototype.at` and `Object.hasOwn`, omit both the polyfill import and the `core-js` installation, including when using the legacy skin.
34
43
 
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).
44
+ See the [documentation](https://videojs-vue-docs.vercel.app) for HLS, custom controls, internationalization, and the API reference. Try the [playground](https://videojs-vue-playground.vercel.app) for interactive examples.
36
45
 
37
- ## Workspace
46
+ ## Audio
38
47
 
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).
48
+ ```vue
49
+ <script setup lang="ts">
50
+ import { AudioPlayer } from 'videojs-vue/audio/default'
51
+ </script>
40
52
 
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
53
+ <template>
54
+ <AudioPlayer
55
+ src="/episode.mp3"
56
+ title="Episode one"
57
+ />
58
+ </template>
47
59
  ```
48
60
 
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
61
+ The fixed audio entry loads only the default audio skin. Use `videojs-vue/audio` when switching between both skins at runtime. Lightweight `core`, `composables`, and individual control entries are also available; see [bundle size and imports](https://videojs-vue-docs.vercel.app/guide/bundle-size). See the [audio API](https://videojs-vue-docs.vercel.app/api/audio).
52
62
 
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.
63
+ ## Credits
54
64
 
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.
65
+ Built on [Video.js](https://videojs.org), which provides the player, media adapters, and controls. Thanks to the [Video.js contributors](https://github.com/videojs/video.js).
56
66
 
57
67
  ## License
58
68
 
@@ -0,0 +1,69 @@
1
+ import { MediaTrack } from "../media/types.js";
2
+ import "../index.js";
3
+ //#region src/audio/Audio.d.ts
4
+ export declare const Audio: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
+ readonly src: import("vue").PropType<string | undefined>;
6
+ readonly autoplay: BooleanConstructor;
7
+ readonly loop: BooleanConstructor;
8
+ readonly preload: {
9
+ readonly type: import("vue").PropType<'none' | 'metadata' | 'auto'>;
10
+ readonly default: 'metadata';
11
+ };
12
+ readonly crossorigin: import("vue").PropType<'' | 'anonymous' | 'use-credentials' | undefined>;
13
+ readonly tracks: import("vue").PropType<readonly MediaTrack[] | undefined>;
14
+ readonly volume: import("vue").PropType<number | undefined>;
15
+ readonly muted: {
16
+ readonly type: import("vue").PropType<boolean | undefined>;
17
+ readonly default: undefined;
18
+ };
19
+ readonly playbackRate: import("vue").PropType<number | undefined>;
20
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
21
+ [key: string]: any;
22
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<"abort" | "canplay" | "canplaythrough" | "durationchange" | "emptied" | "ended" | "enterpictureinpicture" | "error" | "leavepictureinpicture" | "loadeddata" | "loadedmetadata" | "loadstart" | "pause" | "play" | "playing" | "progress" | "ratechange" | "seeked" | "seeking" | "stalled" | "suspend" | "timeupdate" | "volumechange" | "waiting", (event: Event) => boolean>, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
23
+ readonly src: import("vue").PropType<string | undefined>;
24
+ readonly autoplay: BooleanConstructor;
25
+ readonly loop: BooleanConstructor;
26
+ readonly preload: {
27
+ readonly type: import("vue").PropType<'none' | 'metadata' | 'auto'>;
28
+ readonly default: 'metadata';
29
+ };
30
+ readonly crossorigin: import("vue").PropType<'' | 'anonymous' | 'use-credentials' | undefined>;
31
+ readonly tracks: import("vue").PropType<readonly MediaTrack[] | undefined>;
32
+ readonly volume: import("vue").PropType<number | undefined>;
33
+ readonly muted: {
34
+ readonly type: import("vue").PropType<boolean | undefined>;
35
+ readonly default: undefined;
36
+ };
37
+ readonly playbackRate: import("vue").PropType<number | undefined>;
38
+ }>> & Readonly<{
39
+ onAbort?: (event: Event) => any;
40
+ onCanplay?: (event: Event) => any;
41
+ onCanplaythrough?: (event: Event) => any;
42
+ onDurationchange?: (event: Event) => any;
43
+ onEmptied?: (event: Event) => any;
44
+ onEnded?: (event: Event) => any;
45
+ onEnterpictureinpicture?: (event: Event) => any;
46
+ onError?: (event: Event) => any;
47
+ onLeavepictureinpicture?: (event: Event) => any;
48
+ onLoadeddata?: (event: Event) => any;
49
+ onLoadedmetadata?: (event: Event) => any;
50
+ onLoadstart?: (event: Event) => any;
51
+ onPause?: (event: Event) => any;
52
+ onPlay?: (event: Event) => any;
53
+ onPlaying?: (event: Event) => any;
54
+ onProgress?: (event: Event) => any;
55
+ onRatechange?: (event: Event) => any;
56
+ onSeeked?: (event: Event) => any;
57
+ onSeeking?: (event: Event) => any;
58
+ onStalled?: (event: Event) => any;
59
+ onSuspend?: (event: Event) => any;
60
+ onTimeupdate?: (event: Event) => any;
61
+ onVolumechange?: (event: Event) => any;
62
+ onWaiting?: (event: Event) => any;
63
+ }>, {
64
+ readonly autoplay: boolean;
65
+ readonly loop: boolean;
66
+ readonly preload: "auto" | "metadata" | "none";
67
+ readonly muted: boolean | undefined;
68
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
69
+ //#endregion
@@ -0,0 +1,21 @@
1
+ import { mediaEmits } from "../media/events.js";
2
+ import { commonMediaProps } from "../media/props.js";
3
+ import { useMediaElement } from "../media/useMediaElement.js";
4
+ import { defineComponent } from "vue";
5
+ //#region src/audio/Audio.ts
6
+ const Audio = defineComponent({
7
+ name: "Audio",
8
+ inheritAttrs: false,
9
+ props: commonMediaProps,
10
+ emits: mediaEmits,
11
+ setup(props, context) {
12
+ return useMediaElement({
13
+ tag: "audio",
14
+ props,
15
+ context,
16
+ emit: context.emit
17
+ });
18
+ }
19
+ });
20
+ //#endregion
21
+ export { Audio };