@symbiote-native/video 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +67 -2
- package/build/angular/index.d.ts +4 -0
- package/build/angular/index.js +5 -0
- package/build/angular/inject-video-player.d.ts +4 -0
- package/build/angular/inject-video-player.js +6 -0
- package/build/angular/video-airplay-button/index.d.ts +12 -0
- package/build/angular/video-airplay-button/index.js +78 -0
- package/build/angular/video-view/index.d.ts +17 -0
- package/build/angular/video-view/index.js +97 -0
- package/build/core/constants.d.ts +12 -0
- package/build/core/constants.js +13 -0
- package/build/core/index.d.ts +10 -0
- package/build/core/index.js +8 -0
- package/build/core/native-module.d.ts +10 -0
- package/build/core/native-module.js +3 -0
- package/build/core/player-types.d.ts +221 -0
- package/build/core/player-types.js +1 -0
- package/build/core/video-airplay-button.d.ts +4 -0
- package/build/core/video-airplay-button.js +29 -0
- package/build/core/video-module.d.ts +12 -0
- package/build/core/video-module.js +21 -0
- package/build/core/video-player-controller.d.ts +15 -0
- package/build/core/video-player-controller.js +21 -0
- package/build/core/video-player.d.ts +7 -0
- package/build/core/video-player.js +22 -0
- package/build/core/video-source.d.ts +3 -0
- package/build/core/video-source.js +20 -0
- package/build/core/video-thumbnail.d.ts +4 -0
- package/build/core/video-thumbnail.js +3 -0
- package/build/core/video-view.d.ts +18 -0
- package/build/core/video-view.js +63 -0
- package/build/core/view-types.d.ts +90 -0
- package/build/core/view-types.js +1 -0
- package/build/react/index.d.ts +4 -0
- package/build/react/index.js +4 -0
- package/build/react/use-video-player.d.ts +7 -0
- package/build/react/use-video-player.js +11 -0
- package/build/react/video-view.d.ts +13 -0
- package/build/react/video-view.js +10 -0
- package/build/solid/index.d.ts +3 -0
- package/build/solid/index.js +4 -0
- package/build/solid/use-video-player.d.ts +8 -0
- package/build/solid/use-video-player.js +11 -0
- package/build/solid/video-view.d.ts +33 -0
- package/build/solid/video-view.js +6 -0
- package/build/svelte/index.d.ts +5 -0
- package/build/svelte/index.js +5 -0
- package/build/svelte/use-video-player.svelte.d.ts +10 -0
- package/build/svelte/use-video-player.svelte.js +11 -0
- package/build/svelte/video-airplay-button.svelte +12 -0
- package/build/svelte/video-airplay-button.svelte.d.ts +4 -0
- package/build/svelte/video-view.svelte +25 -0
- package/build/svelte/video-view.svelte.d.ts +9 -0
- package/build/vue/index.d.ts +3 -0
- package/build/vue/index.js +4 -0
- package/build/vue/use-video-player.d.ts +8 -0
- package/build/vue/use-video-player.js +16 -0
- package/build/vue/video-view.d.ts +5 -0
- package/build/vue/video-view.js +14 -0
- package/build-ngc/angular/index.d.ts +4 -0
- package/build-ngc/angular/index.js +6 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/angular/inject-video-player.d.ts +4 -0
- package/build-ngc/angular/inject-video-player.js +7 -0
- package/build-ngc/angular/inject-video-player.js.map +1 -0
- package/build-ngc/angular/video-airplay-button/index.d.ts +15 -0
- package/build-ngc/angular/video-airplay-button/index.js +37 -0
- package/build-ngc/angular/video-airplay-button/index.js.map +1 -0
- package/build-ngc/angular/video-view/index.d.ts +20 -0
- package/build-ngc/angular/video-view/index.js +56 -0
- package/build-ngc/angular/video-view/index.js.map +1 -0
- package/build-ngc/core/constants.d.ts +12 -0
- package/build-ngc/core/constants.js +14 -0
- package/build-ngc/core/constants.js.map +1 -0
- package/build-ngc/core/index.d.ts +10 -0
- package/build-ngc/core/index.js +9 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +10 -0
- package/build-ngc/core/native-module.js +4 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/player-types.d.ts +221 -0
- package/build-ngc/core/player-types.js +2 -0
- package/build-ngc/core/player-types.js.map +1 -0
- package/build-ngc/core/video-airplay-button.d.ts +4 -0
- package/build-ngc/core/video-airplay-button.js +30 -0
- package/build-ngc/core/video-airplay-button.js.map +1 -0
- package/build-ngc/core/video-module.d.ts +12 -0
- package/build-ngc/core/video-module.js +22 -0
- package/build-ngc/core/video-module.js.map +1 -0
- package/build-ngc/core/video-player-controller.d.ts +15 -0
- package/build-ngc/core/video-player-controller.js +22 -0
- package/build-ngc/core/video-player-controller.js.map +1 -0
- package/build-ngc/core/video-player.d.ts +7 -0
- package/build-ngc/core/video-player.js +23 -0
- package/build-ngc/core/video-player.js.map +1 -0
- package/build-ngc/core/video-source.d.ts +3 -0
- package/build-ngc/core/video-source.js +21 -0
- package/build-ngc/core/video-source.js.map +1 -0
- package/build-ngc/core/video-thumbnail.d.ts +4 -0
- package/build-ngc/core/video-thumbnail.js +4 -0
- package/build-ngc/core/video-thumbnail.js.map +1 -0
- package/build-ngc/core/video-view.d.ts +18 -0
- package/build-ngc/core/video-view.js +64 -0
- package/build-ngc/core/video-view.js.map +1 -0
- package/build-ngc/core/view-types.d.ts +90 -0
- package/build-ngc/core/view-types.js +2 -0
- package/build-ngc/core/view-types.js.map +1 -0
- package/native-link.json +31 -0
- package/package.json +144 -3
- package/src/angular/index.ts +6 -0
- package/src/angular/inject-video-player.ts +20 -0
- package/src/angular/video-airplay-button/index.ts +39 -0
- package/src/angular/video-view/index.ts +58 -0
- package/src/core/constants.ts +16 -0
- package/src/core/index.ts +56 -0
- package/src/core/native-module.ts +16 -0
- package/src/core/player-types.ts +245 -0
- package/src/core/video-airplay-button.ts +45 -0
- package/src/core/video-module.ts +25 -0
- package/src/core/video-player-controller.ts +50 -0
- package/src/core/video-player.ts +38 -0
- package/src/core/video-source.ts +21 -0
- package/src/core/video-thumbnail.ts +7 -0
- package/src/core/video-view.ts +107 -0
- package/src/core/view-types.ts +114 -0
- package/src/react/index.ts +6 -0
- package/src/react/use-video-player.ts +22 -0
- package/src/react/video-view.ts +33 -0
- package/src/solid/index.ts +5 -0
- package/src/solid/use-video-player.ts +24 -0
- package/src/solid/video-view.ts +22 -0
- package/src/svelte/index.ts +7 -0
- package/src/svelte/svelte-ambient.d.ts +3 -0
- package/src/svelte/svelte-compile.test-helper.ts +6 -0
- package/src/svelte/use-video-player.svelte.ts +27 -0
- package/src/svelte/video-airplay-button.svelte +12 -0
- package/src/svelte/video-view.svelte +25 -0
- package/src/vue/index.ts +5 -0
- package/src/vue/use-video-player.ts +31 -0
- package/src/vue/video-view.ts +21 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createResourceHook } from '@symbiote-native/react';
|
|
2
|
+
import { createVideoPlayerController } from '../core/video-player-controller';
|
|
3
|
+
import type {
|
|
4
|
+
IVideoPlayerBuilderOptions,
|
|
5
|
+
IVideoSource,
|
|
6
|
+
VideoPlayer,
|
|
7
|
+
} from '../core';
|
|
8
|
+
|
|
9
|
+
const usePlayerResource = createResourceHook(createVideoPlayerController);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates a player that is released when the component unmounts
|
|
13
|
+
*
|
|
14
|
+
* `setup` runs once on each new player, a changed source or options make a new one
|
|
15
|
+
*/
|
|
16
|
+
export function useVideoPlayer(
|
|
17
|
+
source: IVideoSource,
|
|
18
|
+
setup?: (player: VideoPlayer) => void,
|
|
19
|
+
playerBuilderOptions?: IVideoPlayerBuilderOptions,
|
|
20
|
+
): VideoPlayer {
|
|
21
|
+
return usePlayerResource(source, playerBuilderOptions, setup);
|
|
22
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactElement, Ref } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
descriptorToReact,
|
|
4
|
+
useNativeViewController,
|
|
5
|
+
} from '@symbiote-native/react';
|
|
6
|
+
import { createVideoView, renderVideoAirPlayButton } from '../core';
|
|
7
|
+
import type {
|
|
8
|
+
IVideoAirPlayButtonProps,
|
|
9
|
+
IVideoViewHandle,
|
|
10
|
+
IVideoViewProps,
|
|
11
|
+
} from '../core';
|
|
12
|
+
|
|
13
|
+
export type IVideoViewReactProps = IVideoViewProps & {
|
|
14
|
+
ref?: Ref<IVideoViewHandle>;
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type IVideoAirPlayButtonReactProps = IVideoAirPlayButtonProps & {
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** React twin of `expo-video`'s `VideoView` */
|
|
23
|
+
export function VideoView({
|
|
24
|
+
ref,
|
|
25
|
+
...props
|
|
26
|
+
}: IVideoViewReactProps): ReactElement | null {
|
|
27
|
+
return useNativeViewController(ref, createVideoView, props);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** React twin of `expo-video`'s `VideoAirPlayButton`, a plain view off iOS */
|
|
31
|
+
export function VideoAirPlayButton(props: IVideoAirPlayButtonReactProps): ReactElement {
|
|
32
|
+
return descriptorToReact(renderVideoAirPlayButton(props));
|
|
33
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Accessor } from 'solid-js';
|
|
2
|
+
import { createResourceHook } from '@symbiote-native/solid';
|
|
3
|
+
import { createVideoPlayerController } from '../core/video-player-controller';
|
|
4
|
+
import type {
|
|
5
|
+
IVideoPlayerBuilderOptions,
|
|
6
|
+
IVideoSource,
|
|
7
|
+
VideoPlayer,
|
|
8
|
+
} from '../core';
|
|
9
|
+
|
|
10
|
+
const usePlayerResource = createResourceHook(createVideoPlayerController);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Solid twin of `expo-video`'s `useVideoPlayer`, released when the owner is disposed
|
|
14
|
+
*
|
|
15
|
+
* `setup` runs once on each new player, a changed source or options make a new one
|
|
16
|
+
*/
|
|
17
|
+
export function useVideoPlayer(
|
|
18
|
+
source: Accessor<IVideoSource>,
|
|
19
|
+
setup?: (player: VideoPlayer) => void,
|
|
20
|
+
playerBuilderOptions: Accessor<IVideoPlayerBuilderOptions | undefined> = () =>
|
|
21
|
+
undefined,
|
|
22
|
+
): Accessor<VideoPlayer> {
|
|
23
|
+
return usePlayerResource(() => [source(), playerBuilderOptions(), setup]);
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineNativeViewComponent,
|
|
3
|
+
defineOptionalDescriptorComponent,
|
|
4
|
+
} from '@symbiote-native/solid';
|
|
5
|
+
import { createVideoView, renderVideoAirPlayButton } from '../core';
|
|
6
|
+
import type {
|
|
7
|
+
IVideoAirPlayButtonProps,
|
|
8
|
+
IVideoViewHandle,
|
|
9
|
+
IVideoViewProps,
|
|
10
|
+
} from '../core';
|
|
11
|
+
|
|
12
|
+
/** Solid twin of `expo-video`'s `VideoView`, `ref` gets the handle of the view */
|
|
13
|
+
export const VideoView = defineNativeViewComponent<
|
|
14
|
+
IVideoViewHandle,
|
|
15
|
+
IVideoViewProps
|
|
16
|
+
>(createVideoView);
|
|
17
|
+
|
|
18
|
+
/** Solid twin of `expo-video`'s `VideoAirPlayButton`, a plain view off iOS */
|
|
19
|
+
export const VideoAirPlayButton =
|
|
20
|
+
defineOptionalDescriptorComponent<IVideoAirPlayButtonProps>(
|
|
21
|
+
renderVideoAirPlayButton,
|
|
22
|
+
);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @symbiote-native/video/svelte: плеер, view, миниатюры, кэш и кнопка AirPlay на общем ядре
|
|
2
|
+
|
|
3
|
+
export { default as VideoView } from './video-view.svelte';
|
|
4
|
+
export { default as VideoAirPlayButton } from './video-airplay-button.svelte';
|
|
5
|
+
export { useVideoPlayer } from './use-video-player.svelte';
|
|
6
|
+
export type { IUseVideoPlayerResult } from './use-video-player.svelte';
|
|
7
|
+
export * from '../core';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createResourceHook } from '@symbiote-native/svelte/runes/create-resource-hook';
|
|
2
|
+
import { createVideoPlayerController } from '../core/video-player-controller';
|
|
3
|
+
import type {
|
|
4
|
+
IVideoPlayerBuilderOptions,
|
|
5
|
+
IVideoSource,
|
|
6
|
+
VideoPlayer,
|
|
7
|
+
} from '../core';
|
|
8
|
+
|
|
9
|
+
export type IUseVideoPlayerResult = {
|
|
10
|
+
readonly current: VideoPlayer;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const usePlayerResource = createResourceHook(createVideoPlayerController);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Svelte twin of `expo-video`'s `useVideoPlayer`, boxed getter shape of the other resource hooks
|
|
17
|
+
*
|
|
18
|
+
* `setup` runs once on each new player, a changed source or options make a new one
|
|
19
|
+
*/
|
|
20
|
+
export function useVideoPlayer(
|
|
21
|
+
getSource: () => IVideoSource,
|
|
22
|
+
setup?: (player: VideoPlayer) => void,
|
|
23
|
+
getPlayerBuilderOptions: () => IVideoPlayerBuilderOptions | undefined = () =>
|
|
24
|
+
undefined,
|
|
25
|
+
): IUseVideoPlayerResult {
|
|
26
|
+
return usePlayerResource(() => [getSource(), getPlayerBuilderOptions(), setup]);
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// The native view name is mixed-case, which a literal tag would parse as a component reference,
|
|
3
|
+
// so the tag is dynamic
|
|
4
|
+
import { hostProps } from '@symbiote-native/svelte/native-view-bridge';
|
|
5
|
+
import { renderVideoAirPlayButton } from '../core';
|
|
6
|
+
import type { IVideoAirPlayButtonProps } from '../core';
|
|
7
|
+
|
|
8
|
+
const props: IVideoAirPlayButtonProps = $props();
|
|
9
|
+
const descriptor = $derived(renderVideoAirPlayButton({ ...props }));
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<svelte:element this={descriptor.type} {@attach hostProps(descriptor.props)} />
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// The native view name is mixed-case, which a literal tag would parse as a component reference,
|
|
3
|
+
// so the tag is dynamic
|
|
4
|
+
import { hostProps } from '@symbiote-native/svelte/native-view-bridge';
|
|
5
|
+
import { useNativeViewController } from '@symbiote-native/svelte/runes/use-native-view-controller';
|
|
6
|
+
import { createVideoView } from '../core';
|
|
7
|
+
import type { IVideoViewProps } from '../core';
|
|
8
|
+
|
|
9
|
+
const props: IVideoViewProps = $props();
|
|
10
|
+
const view = useNativeViewController(createVideoView, () => ({ ...props }));
|
|
11
|
+
|
|
12
|
+
// The functions of the view are instance members, `bind:this` reaches them
|
|
13
|
+
export const enterFullscreen = view.handle.enterFullscreen;
|
|
14
|
+
export const exitFullscreen = view.handle.exitFullscreen;
|
|
15
|
+
export const startPictureInPicture = view.handle.startPictureInPicture;
|
|
16
|
+
export const stopPictureInPicture = view.handle.stopPictureInPicture;
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
{#if view.descriptor}
|
|
20
|
+
<svelte:element
|
|
21
|
+
this={view.descriptor.type}
|
|
22
|
+
{@attach view.attachHost}
|
|
23
|
+
{@attach hostProps(view.descriptor.props)}
|
|
24
|
+
/>
|
|
25
|
+
{/if}
|
package/src/vue/index.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toValue,
|
|
3
|
+
type ComputedRef,
|
|
4
|
+
type MaybeRefOrGetter,
|
|
5
|
+
} from '@vue/runtime-core';
|
|
6
|
+
import { createResourceHook } from '@symbiote-native/vue';
|
|
7
|
+
import { createVideoPlayerController } from '../core/video-player-controller';
|
|
8
|
+
import type {
|
|
9
|
+
IVideoPlayerBuilderOptions,
|
|
10
|
+
IVideoSource,
|
|
11
|
+
VideoPlayer,
|
|
12
|
+
} from '../core';
|
|
13
|
+
|
|
14
|
+
const usePlayerResource = createResourceHook(createVideoPlayerController);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Vue twin of `expo-video`'s `useVideoPlayer`, released when the owner unmounts
|
|
18
|
+
*
|
|
19
|
+
* `setup` runs once on each new player, a changed source or options make a new one
|
|
20
|
+
*/
|
|
21
|
+
export function useVideoPlayer(
|
|
22
|
+
source: MaybeRefOrGetter<IVideoSource>,
|
|
23
|
+
setup?: (player: VideoPlayer) => void,
|
|
24
|
+
playerBuilderOptions?: MaybeRefOrGetter<IVideoPlayerBuilderOptions | undefined>,
|
|
25
|
+
): ComputedRef<VideoPlayer> {
|
|
26
|
+
return usePlayerResource(() => [
|
|
27
|
+
toValue(source),
|
|
28
|
+
toValue(playerBuilderOptions),
|
|
29
|
+
setup,
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineComponent, type VNode } from '@vue/runtime-core';
|
|
2
|
+
import {
|
|
3
|
+
defineNativeViewComponent,
|
|
4
|
+
descriptorToVue,
|
|
5
|
+
normalizeVueAttrs,
|
|
6
|
+
} from '@symbiote-native/vue';
|
|
7
|
+
import { createVideoView, renderVideoAirPlayButton } from '../core';
|
|
8
|
+
|
|
9
|
+
/** Vue twin of `expo-video`'s `VideoView` */
|
|
10
|
+
export const VideoView = defineNativeViewComponent('VideoView', createVideoView);
|
|
11
|
+
|
|
12
|
+
/** Vue twin of `expo-video`'s `VideoAirPlayButton`, a plain view off iOS */
|
|
13
|
+
export const VideoAirPlayButton = defineComponent({
|
|
14
|
+
name: 'VideoAirPlayButton',
|
|
15
|
+
// Все атрибуты это пропсы нативного view, на обёртку ничего не должно просочиться
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
setup(_props, { attrs }) {
|
|
18
|
+
return (): VNode =>
|
|
19
|
+
descriptorToVue(renderVideoAirPlayButton(normalizeVueAttrs(attrs)));
|
|
20
|
+
},
|
|
21
|
+
});
|