react-native-spalla-player 0.13.3 → 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.
Files changed (53) hide show
  1. package/LICENSE +2 -3
  2. package/SpallaPlayer.podspec +22 -0
  3. package/android/build.gradle +22 -58
  4. package/android/gradle.properties +5 -5
  5. package/android/src/main/AndroidManifest.xml +1 -2
  6. package/android/src/main/java/com/spallaplayer/RNSpallaPlayerEvent.kt +19 -0
  7. package/android/src/main/java/com/spallaplayer/SpallaPlayerModule.fabric.kt +103 -0
  8. package/android/src/main/java/com/spallaplayer/SpallaPlayerModule.kt +32 -21
  9. package/android/src/main/java/com/spallaplayer/SpallaPlayerPackage.kt +18 -4
  10. package/android/src/main/java/com/spallaplayer/SpallaPlayerView.kt +15 -0
  11. package/android/src/main/java/com/spallaplayer/SpallaPlayerViewManager.fabric.kt +289 -0
  12. package/android/src/main/java/com/spallaplayer/SpallaPlayerViewManager.kt +25 -27
  13. package/ios/SpallaPlayerModule.h +17 -0
  14. package/ios/SpallaPlayerModule.mm +59 -0
  15. package/ios/SpallaPlayerView.h +14 -0
  16. package/ios/SpallaPlayerView.mm +158 -0
  17. package/ios/SpallaPlayerWrapper.swift +12 -8
  18. package/lib/module/NativeSpallaPlayerModule.js +5 -0
  19. package/lib/module/NativeSpallaPlayerModule.js.map +1 -0
  20. package/lib/module/SpallaPlayerViewNativeComponent.js +11 -0
  21. package/lib/module/SpallaPlayerViewNativeComponent.js.map +1 -0
  22. package/lib/module/index.js +48 -55
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/typescript/src/NativeSpallaPlayerModule.d.ts +13 -0
  25. package/lib/typescript/src/NativeSpallaPlayerModule.d.ts.map +1 -0
  26. package/lib/typescript/src/SpallaPlayerViewNativeComponent.d.ts +33 -0
  27. package/lib/typescript/src/SpallaPlayerViewNativeComponent.d.ts.map +1 -0
  28. package/lib/typescript/src/components/CastButton.d.ts.map +1 -0
  29. package/lib/typescript/{module/src → src}/index.d.ts +9 -15
  30. package/lib/typescript/src/index.d.ts.map +1 -0
  31. package/package.json +93 -103
  32. package/src/NativeSpallaPlayerModule.ts +14 -0
  33. package/src/SpallaPlayerViewNativeComponent.ts +61 -0
  34. package/src/index.tsx +71 -82
  35. package/android/src/main/AndroidManifestNew.xml +0 -2
  36. package/android/src/main/java/com/spallaplayer/SpallaPlayerContainerView.kt +0 -36
  37. package/ios/RNSpallaPlayer.m +0 -102
  38. package/ios/RNSpallaPlayer.swift +0 -11
  39. package/ios/SpallaPlayer-Bridging-Header.h +0 -1
  40. package/lib/commonjs/components/CastButton.js +0 -49
  41. package/lib/commonjs/components/CastButton.js.map +0 -1
  42. package/lib/commonjs/index.js +0 -81
  43. package/lib/commonjs/index.js.map +0 -1
  44. package/lib/typescript/commonjs/package.json +0 -1
  45. package/lib/typescript/commonjs/src/components/CastButton.d.ts.map +0 -1
  46. package/lib/typescript/commonjs/src/index.d.ts +0 -61
  47. package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
  48. package/lib/typescript/module/src/components/CastButton.d.ts +0 -13
  49. package/lib/typescript/module/src/components/CastButton.d.ts.map +0 -1
  50. package/lib/typescript/module/src/index.d.ts.map +0 -1
  51. package/react-native-spalla-player.podspec +0 -44
  52. /package/lib/{typescript/module → module}/package.json +0 -0
  53. /package/lib/typescript/{commonjs/src → src}/components/CastButton.d.ts +0 -0
@@ -0,0 +1,61 @@
1
+ import {
2
+ codegenNativeComponent,
3
+ type ViewProps,
4
+ type CodegenTypes,
5
+ type HostComponent,
6
+ codegenNativeCommands,
7
+ } from 'react-native';
8
+
9
+ // Define a single comprehensive event payload interface
10
+ interface PlayerEventPayload {
11
+ event: string;
12
+ time?: CodegenTypes.Double;
13
+ duration?: CodegenTypes.Double;
14
+ isLive?: boolean;
15
+ subtitles?: string[];
16
+ subtitle?: string;
17
+ rate?: CodegenTypes.Float;
18
+ message?: string;
19
+ error?: string;
20
+ }
21
+
22
+ export interface NativeProps extends ViewProps {
23
+ contentId?: string;
24
+ muted?: boolean;
25
+ startTime?: CodegenTypes.Double;
26
+ subtitle?: string | null;
27
+ playbackRate?: CodegenTypes.Float;
28
+ hideUI?: boolean;
29
+ onPlayerEvent?: CodegenTypes.BubblingEventHandler<PlayerEventPayload>;
30
+ }
31
+
32
+ export interface NativeCommands {
33
+ play: (viewRef: React.ElementRef<HostComponent<any>>) => void;
34
+ pause: (viewRef: React.ElementRef<HostComponent<any>>) => void;
35
+ seekTo: (
36
+ viewRef: React.ElementRef<HostComponent<any>>,
37
+ time: CodegenTypes.Double
38
+ ) => void;
39
+ selectSubtitle: (
40
+ viewRef: React.ElementRef<HostComponent<any>>,
41
+ subtitle: string | null
42
+ ) => void;
43
+ selectPlaybackRate: (
44
+ viewRef: React.ElementRef<HostComponent<any>>,
45
+ rate: CodegenTypes.Float
46
+ ) => void;
47
+ unmount: (viewRef: React.ElementRef<HostComponent<any>>) => void;
48
+ }
49
+
50
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
51
+ supportedCommands: [
52
+ 'play',
53
+ 'pause',
54
+ 'seekTo',
55
+ 'selectSubtitle',
56
+ 'selectPlaybackRate',
57
+ 'unmount',
58
+ ],
59
+ });
60
+
61
+ export default codegenNativeComponent<NativeProps>('SpallaPlayerView');
package/src/index.tsx CHANGED
@@ -1,28 +1,22 @@
1
1
  import React from 'react';
2
- import {
3
- requireNativeComponent,
4
- type ViewStyle,
5
- NativeModules,
6
- findNodeHandle,
7
- } from 'react-native';
2
+ import { type ViewStyle } from 'react-native';
3
+ import { Commands } from './SpallaPlayerViewNativeComponent';
8
4
 
9
- type allowedPlaybackRates = 0.25 | 0.5 | 1.0 | 1.25 | 1.5 | 2.0;
5
+ // Import the appropriate component based on architecture
6
+ const isFabricEnabled = (global as any)?.nativeFabricUIManager != null;
10
7
 
11
- interface RNSpallaPlayerProps {
12
- children?: React.ReactNode;
13
- style?: ViewStyle;
14
- startTime: number;
15
- subtitle?: String | null;
16
- playbackRate?: allowedPlaybackRates;
17
- hideUI?: boolean;
18
- ref?: (ref: any) => void;
19
- }
8
+ const RNSpallaPlayer = isFabricEnabled
9
+ ? require('./SpallaPlayerViewNativeComponent').default
10
+ : require('react-native').requireNativeComponent('RNSpallaPlayer');
20
11
 
21
- const RNSpallaPlayer =
22
- requireNativeComponent<RNSpallaPlayerProps>('RNSpallaPlayer');
12
+ // Import the appropriate module
13
+ const RNSpallaPlayerModule = isFabricEnabled
14
+ ? require('./NativeSpallaPlayerModule').default
15
+ : require('react-native').NativeModules.RNSpallaPlayer;
23
16
 
24
- const RNSpallaPlayerModule = NativeModules.RNSpallaPlayer;
17
+ type allowedPlaybackRates = 0.25 | 0.5 | 1.0 | 1.25 | 1.5 | 2.0;
25
18
 
19
+ // Event interfaces (keep these as they are)
26
20
  interface PlayerEventTimeUpdate {
27
21
  event: 'timeUpdate';
28
22
  time: number;
@@ -76,11 +70,11 @@ interface Props {
76
70
  autoplay?: boolean;
77
71
  startTime?: number;
78
72
  subtitle?: String | null;
79
- playbackRate?: 0.25 | 0.5 | 1.0 | 1.25 | 1.5 | 2.0;
73
+ playbackRate?: allowedPlaybackRates;
80
74
  onPlayerEvent?: (event: {
81
75
  nativeEvent:
82
- | PlayerEventTimeUpdate
83
76
  | PlayerEvent
77
+ | PlayerEventTimeUpdate
84
78
  | PlayerEventDurationUpdate
85
79
  | PlayerEventSubtitlesAvailable
86
80
  | PlayerEventSubtitleSelected
@@ -89,71 +83,66 @@ interface Props {
89
83
  }) => void;
90
84
  }
91
85
 
92
- export const play = (ref: any) => {
93
- const handle = findNodeHandle(ref);
94
- RNSpallaPlayerModule.play(handle);
95
- };
96
-
97
- export const pause = (ref: any) => {
98
- const handle = findNodeHandle(ref);
99
- RNSpallaPlayerModule.pause(handle);
100
- };
101
-
102
- export const seekTo = (ref: any, time: number) => {
103
- const handle = findNodeHandle(ref);
104
- RNSpallaPlayerModule.seekTo(handle, time);
86
+ export const initialize = (token: string, applicationId: string | null) => {
87
+ RNSpallaPlayerModule.initialize(token, applicationId);
105
88
  };
106
89
 
107
- //export default SpallaPlayer;
108
-
109
- class SpallaPlayer extends React.Component<Props> {
110
- _player = null;
111
-
112
- _setRef = (ref: any) => {
113
- this._player = ref;
114
- };
115
-
116
- render() {
117
- const { style, startTime, playbackRate, hideUI } = this.props;
118
-
119
- return (
120
- <RNSpallaPlayer
121
- {...this.props}
122
- ref={this._setRef}
123
- style={style}
124
- startTime={startTime ?? 0}
125
- playbackRate={playbackRate ?? 1.0}
126
- hideUI={hideUI ?? false}
127
- >
128
- {this.props.children}
129
- </RNSpallaPlayer>
130
- );
131
- }
132
-
133
- play = () => {
134
- const handle = findNodeHandle(this._player);
135
- RNSpallaPlayerModule.play(handle);
136
- };
137
-
138
- pause = () => {
139
- const handle = findNodeHandle(this._player);
140
- RNSpallaPlayerModule.pause(handle);
141
- };
142
-
143
- seekTo = (time: number) => {
144
- const handle = findNodeHandle(this._player);
145
- RNSpallaPlayerModule.seekTo(handle, time);
146
- };
147
-
148
- componentWillUnmount() {
149
- const handle = findNodeHandle(this._player);
150
- RNSpallaPlayerModule.unmount(handle);
151
- }
90
+ export interface SpallaPlayerRef {
91
+ play(): void;
92
+ pause(): void;
93
+ seekTo(time: number): void;
152
94
  }
153
95
 
154
- export const initialize = (token: String, applicationId: String | null) => {
155
- RNSpallaPlayerModule.initialize(token, applicationId);
156
- };
96
+ const SpallaPlayer = React.forwardRef<SpallaPlayerRef, Props>((props, ref) => {
97
+ const playerRef = React.useRef(null);
98
+
99
+ React.useImperativeHandle(
100
+ ref,
101
+ () => ({
102
+ play: () => {
103
+ if (playerRef.current) {
104
+ Commands.play(playerRef.current);
105
+ }
106
+ },
107
+ pause: () => {
108
+ console.log('Calling pause command');
109
+ if (playerRef.current) {
110
+ Commands.pause(playerRef.current);
111
+ }
112
+ },
113
+ seekTo: (time: number) => {
114
+ if (playerRef.current) {
115
+ Commands.seekTo(playerRef.current, time);
116
+ }
117
+ },
118
+ }),
119
+ []
120
+ );
121
+
122
+ React.useEffect(() => {
123
+ const currentRef = playerRef.current;
124
+ return () => {
125
+ if (currentRef) {
126
+ Commands.unmount(currentRef);
127
+ }
128
+ };
129
+ }, []);
130
+
131
+ return (
132
+ <RNSpallaPlayer
133
+ {...props}
134
+ ref={playerRef}
135
+ style={props.style}
136
+ startTime={props.startTime ?? 0}
137
+ playbackRate={props.playbackRate ?? 1.0}
138
+ hideUI={props.hideUI ?? false}
139
+ >
140
+ {props.children}
141
+ </RNSpallaPlayer>
142
+ );
143
+ });
144
+
145
+ SpallaPlayer.displayName = 'SpallaPlayer';
157
146
 
158
147
  export default SpallaPlayer;
159
148
  export { default as SpallaCastButton } from './components/CastButton';
@@ -1,2 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
- </manifest>
@@ -1,36 +0,0 @@
1
- package com.spallaplayer
2
-
3
- import android.content.Context
4
- import android.widget.FrameLayout
5
- import com.spalla.sdk.android.core.player.view.SpallaPlayerView
6
- import android.view.ViewGroup;
7
-
8
- class SpallaPlayerContainerView(context: Context) : ViewGroup(context) {
9
- val spallaPlayerView: SpallaPlayerView = SpallaPlayerView(context)
10
-
11
- init {
12
- addView(spallaPlayerView) // Add SpallaPlayerView as a child of this container
13
- // You might need to set layout params for spallaPlayerView here
14
- }
15
-
16
- override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
17
- for (i in 0 until childCount) {
18
- val child = getChildAt(i)
19
- child.layout(0, 0, width, height)
20
- }
21
- }
22
-
23
- override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
24
- val width = MeasureSpec.getSize(widthMeasureSpec)
25
- val height = MeasureSpec.getSize(heightMeasureSpec)
26
- for (i in 0 until childCount) {
27
- val child = getChildAt(i)
28
- child.measure(
29
- MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
30
- MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
31
- )
32
- }
33
- setMeasuredDimension(width, height)
34
- }
35
-
36
- }
@@ -1,102 +0,0 @@
1
- #import <React/RCTViewManager.h>
2
- #import <React/RCTUIManager.h>
3
- #import <react_native_spalla_player-Swift.h>
4
- @import SpallaSDK;
5
-
6
- @interface RCT_EXTERN_MODULE(RNSpallaPlayer, RCTViewManager)
7
-
8
- RCT_EXPORT_VIEW_PROPERTY(contentId, NSString)
9
-
10
- RCT_EXPORT_VIEW_PROPERTY(muted, BOOL)
11
-
12
- RCT_EXPORT_VIEW_PROPERTY(hideUI, BOOL)
13
-
14
- RCT_EXPORT_VIEW_PROPERTY(startTime, NSNumber)
15
-
16
- RCT_EXPORT_VIEW_PROPERTY(subtitle, NSString)
17
-
18
- RCT_EXPORT_VIEW_PROPERTY(playbackRate, NSNumber)
19
-
20
- RCT_EXPORT_METHOD(play: (nonnull NSNumber *) reactTag {
21
-
22
- [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
23
- UIView *view = viewRegistry[reactTag];
24
- if (!view || ![view isKindOfClass:[SpallaPlayerWrapper class]]) {
25
- RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
26
- return;
27
- } else {
28
- [(SpallaPlayerWrapper *)view play];
29
- }
30
-
31
- }];
32
- })
33
-
34
- RCT_EXPORT_METHOD(pause: (nonnull NSNumber *) reactTag {
35
- [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
36
- UIView *view = viewRegistry[reactTag];
37
- if (!view || ![view isKindOfClass:[SpallaPlayerWrapper class]]) {
38
- RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
39
- return;
40
- } else {
41
- [(SpallaPlayerWrapper *)view pause];
42
- }
43
- }];
44
- })
45
-
46
- RCT_EXPORT_METHOD(seekTo: (nonnull NSNumber *) reactTag time:(float)time) {
47
- [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
48
- UIView *view = viewRegistry[reactTag];
49
- if (!view || ![view isKindOfClass:[SpallaPlayerWrapper class]]) {
50
- RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
51
- return;
52
- } else {
53
- [(SpallaPlayerWrapper *)view seekToTime: time];
54
- }
55
- }];
56
- }
57
-
58
- RCT_EXPORT_METHOD(selectSubtitle: (nonnull NSNumber *) reactTag subtitle:(NSString *)subtitle) {
59
- [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
60
- UIView *view = viewRegistry[reactTag];
61
- if (!view || ![view isKindOfClass:[SpallaPlayerWrapper class]]) {
62
- RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
63
- return;
64
- } else {
65
- [(SpallaPlayerWrapper *)view selectSubtitle: subtitle];
66
- }
67
- }];
68
- }
69
-
70
- RCT_EXPORT_METHOD(selectPlaybackRate: (nonnull NSNumber *) reactTag rate:(NSNumber *)rate) {
71
- [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
72
- UIView *view = viewRegistry[reactTag];
73
- if (!view || ![view isKindOfClass:[SpallaPlayerWrapper class]]) {
74
- RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
75
- return;
76
- } else {
77
- [(SpallaPlayerWrapper *)view selectPlaybackRate: rate.doubleValue];
78
- }
79
- }];
80
- }
81
-
82
- RCT_EXPORT_METHOD(initialize: (nonnull NSString *) token: (NSString *) applicationId) {
83
- dispatch_async(dispatch_get_main_queue(), ^{
84
- [SpallaPlayerWrapper initializeWithToken: token applicationId: applicationId];
85
- });
86
- }
87
-
88
- RCT_EXPORT_METHOD(unmount: (nonnull NSNumber *) reactTag {
89
- [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
90
- UIView *view = viewRegistry[reactTag];
91
- if (!view || ![view isKindOfClass:[SpallaPlayerWrapper class]]) {
92
- RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
93
- return;
94
- } else {
95
- [(SpallaPlayerWrapper *)view unmount];
96
- }
97
- }];
98
- })
99
-
100
- RCT_EXPORT_VIEW_PROPERTY(onPlayerEvent, RCTBubblingEventBlock)
101
-
102
- @end
@@ -1,11 +0,0 @@
1
- @objc(RNSpallaPlayer)
2
- class RNSpallaPlayer: RCTViewManager {
3
-
4
- override func view() -> (SpallaPlayerWrapper) {
5
- return SpallaPlayerWrapper()
6
- }
7
-
8
- @objc override static func requiresMainQueueSetup() -> Bool {
9
- return true
10
- }
11
- }
@@ -1 +0,0 @@
1
- #import <React/RCTViewManager.h>
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = CastButton;
7
- var _reactNative = require("react-native");
8
- var _jsxRuntime = require("react/jsx-runtime");
9
- function CastButton({
10
- style,
11
- ...rest
12
- }) {
13
- // @ts-ignore FIXME
14
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(GoogleCastButton, {
15
- style: [styles.default, style],
16
- ...rest
17
- });
18
- }
19
- CastButton.propTypes = {
20
- /**
21
- * A flag that indicates whether a touch event on this button will trigger the display of the Cast dialog that is provided by the framework.
22
- *
23
- * By default this property is set to YES. If an application wishes to handle touch events itself, it should set the property to NO and register an appropriate target and action for the touch event.
24
- */
25
- // triggersDefaultCastDialog: PropTypes.bool
26
- // accessibilityLabel: PropTypes.string
27
- };
28
- const GoogleCastButton = (0, _reactNative.requireNativeComponent)('RNGoogleCastButton'
29
- // CastButton
30
- // {
31
- // nativeOnly: {
32
- // accessibilityLabel: true,
33
- // accessibilityLiveRegion: true,
34
- // accessibilityComponentType: true,
35
- // testID: true,
36
- // nativeID: true,
37
- // importantForAccessibility: true,
38
- // renderToHardwareTextureAndroid: true,
39
- // onLayout: true,
40
- // },
41
- // }
42
- );
43
- const styles = _reactNative.StyleSheet.create({
44
- default: {
45
- width: 40,
46
- height: 40
47
- }
48
- });
49
- //# sourceMappingURL=CastButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNative","require","_jsxRuntime","CastButton","style","rest","jsx","GoogleCastButton","styles","default","propTypes","requireNativeComponent","StyleSheet","create","width","height"],"sourceRoot":"../../../src","sources":["components/CastButton.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAIsB,IAAAC,WAAA,GAAAD,OAAA;AAOP,SAASE,UAAUA,CAAC;EAAEC,KAAK;EAAE,GAAGC;AAAY,CAAC,EAAE;EAC5D;EACA,oBAAO,IAAAH,WAAA,CAAAI,GAAA,EAACC,gBAAgB;IAACH,KAAK,EAAE,CAACI,MAAM,CAACC,OAAO,EAAEL,KAAK,CAAE;IAAA,GAAKC;EAAI,CAAG,CAAC;AACvE;AAEAF,UAAU,CAACO,SAAS,GAAG;EACrB;AACF;AACA;AACA;AACA;EACE;EACA;AAAA,CACD;AAED,MAAMH,gBAAgB,GAAG,IAAAI,mCAAsB,EAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,CAAC;AAED,MAAMH,MAAM,GAAGI,uBAAU,CAACC,MAAM,CAAC;EAC/BJ,OAAO,EAAE;IACPK,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "SpallaCastButton", {
7
- enumerable: true,
8
- get: function () {
9
- return _CastButton.default;
10
- }
11
- });
12
- exports.seekTo = exports.play = exports.pause = exports.initialize = exports.default = void 0;
13
- var _react = _interopRequireDefault(require("react"));
14
- var _reactNative = require("react-native");
15
- var _jsxRuntime = require("react/jsx-runtime");
16
- var _CastButton = _interopRequireDefault(require("./components/CastButton.js"));
17
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
- const RNSpallaPlayer = (0, _reactNative.requireNativeComponent)('RNSpallaPlayer');
19
- const RNSpallaPlayerModule = _reactNative.NativeModules.RNSpallaPlayer;
20
- const play = ref => {
21
- const handle = (0, _reactNative.findNodeHandle)(ref);
22
- RNSpallaPlayerModule.play(handle);
23
- };
24
- exports.play = play;
25
- const pause = ref => {
26
- const handle = (0, _reactNative.findNodeHandle)(ref);
27
- RNSpallaPlayerModule.pause(handle);
28
- };
29
- exports.pause = pause;
30
- const seekTo = (ref, time) => {
31
- const handle = (0, _reactNative.findNodeHandle)(ref);
32
- RNSpallaPlayerModule.seekTo(handle, time);
33
- };
34
-
35
- //export default SpallaPlayer;
36
- exports.seekTo = seekTo;
37
- class SpallaPlayer extends _react.default.Component {
38
- _player = null;
39
- _setRef = ref => {
40
- this._player = ref;
41
- };
42
- render() {
43
- const {
44
- style,
45
- startTime,
46
- playbackRate,
47
- hideUI
48
- } = this.props;
49
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(RNSpallaPlayer, {
50
- ...this.props,
51
- ref: this._setRef,
52
- style: style,
53
- startTime: startTime ?? 0,
54
- playbackRate: playbackRate ?? 1.0,
55
- hideUI: hideUI ?? false,
56
- children: this.props.children
57
- });
58
- }
59
- play = () => {
60
- const handle = (0, _reactNative.findNodeHandle)(this._player);
61
- RNSpallaPlayerModule.play(handle);
62
- };
63
- pause = () => {
64
- const handle = (0, _reactNative.findNodeHandle)(this._player);
65
- RNSpallaPlayerModule.pause(handle);
66
- };
67
- seekTo = time => {
68
- const handle = (0, _reactNative.findNodeHandle)(this._player);
69
- RNSpallaPlayerModule.seekTo(handle, time);
70
- };
71
- componentWillUnmount() {
72
- const handle = (0, _reactNative.findNodeHandle)(this._player);
73
- RNSpallaPlayerModule.unmount(handle);
74
- }
75
- }
76
- const initialize = (token, applicationId) => {
77
- RNSpallaPlayerModule.initialize(token, applicationId);
78
- };
79
- exports.initialize = initialize;
80
- var _default = exports.default = SpallaPlayer;
81
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_jsxRuntime","_CastButton","e","__esModule","default","RNSpallaPlayer","requireNativeComponent","RNSpallaPlayerModule","NativeModules","play","ref","handle","findNodeHandle","exports","pause","seekTo","time","SpallaPlayer","React","Component","_player","_setRef","render","style","startTime","playbackRate","hideUI","props","jsx","children","componentWillUnmount","unmount","initialize","token","applicationId","_default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAKsB,IAAAE,WAAA,GAAAF,OAAA;AAwJtB,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAsE,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA1ItE,MAAMG,cAAc,GAClB,IAAAC,mCAAsB,EAAsB,gBAAgB,CAAC;AAE/D,MAAMC,oBAAoB,GAAGC,0BAAa,CAACH,cAAc;AAoElD,MAAMI,IAAI,GAAIC,GAAQ,IAAK;EAChC,MAAMC,MAAM,GAAG,IAAAC,2BAAc,EAACF,GAAG,CAAC;EAClCH,oBAAoB,CAACE,IAAI,CAACE,MAAM,CAAC;AACnC,CAAC;AAACE,OAAA,CAAAJ,IAAA,GAAAA,IAAA;AAEK,MAAMK,KAAK,GAAIJ,GAAQ,IAAK;EACjC,MAAMC,MAAM,GAAG,IAAAC,2BAAc,EAACF,GAAG,CAAC;EAClCH,oBAAoB,CAACO,KAAK,CAACH,MAAM,CAAC;AACpC,CAAC;AAACE,OAAA,CAAAC,KAAA,GAAAA,KAAA;AAEK,MAAMC,MAAM,GAAGA,CAACL,GAAQ,EAAEM,IAAY,KAAK;EAChD,MAAML,MAAM,GAAG,IAAAC,2BAAc,EAACF,GAAG,CAAC;EAClCH,oBAAoB,CAACQ,MAAM,CAACJ,MAAM,EAAEK,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AAM,GAAG,IAAAC,2BAAc,EAAC,IAAI,CAACQ,OAAO,CAAC;IAC3Cb,oBAAoB,CAACwB,OAAO,CAACpB,MAAM,CAAC;EACtC;AACF;AAEO,MAAMqB,UAAU,GAAGA,CAACC,KAAa,EAAEC,aAA4B,KAAK;EACzE3B,oBAAoB,CAACyB,UAAU,CAACC,KAAK,EAAEC,aAAa,CAAC;AACvD,CAAC;AAACrB,OAAA,CAAAmB,UAAA,GAAAA,UAAA;AAAA,IAAAG,QAAA,GAAAtB,OAAA,CAAAT,OAAA,GAEaa,YAAY","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"type":"commonjs"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CastButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/CastButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,KAAM,SAAQ,SAAS;IACtC,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iBAAwB,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,2CAG3D;kBAHuB,UAAU;;;eAAV,UAAU"}
@@ -1,61 +0,0 @@
1
- import React from 'react';
2
- import { type ViewStyle } from 'react-native';
3
- type allowedPlaybackRates = 0.25 | 0.5 | 1.0 | 1.25 | 1.5 | 2.0;
4
- interface PlayerEventTimeUpdate {
5
- event: 'timeUpdate';
6
- time: number;
7
- }
8
- interface PlayerEventDurationUpdate {
9
- event: 'durationUpdate';
10
- duration: number;
11
- }
12
- interface PlayerEventSubtitlesAvailable {
13
- event: 'subtitlesAvailable';
14
- subtitles: Array<String>;
15
- }
16
- interface PlayerEventSubtitleSelected {
17
- event: 'subtitleSelected';
18
- subtitle: String;
19
- }
20
- interface PlayerEventPlaybackRateSelected {
21
- event: 'playbackRateSelected';
22
- rate: allowedPlaybackRates;
23
- }
24
- interface PlayerEventMedataLoaded {
25
- event: 'metadataLoaded';
26
- isLive: boolean;
27
- duration: number;
28
- }
29
- interface PlayerEvent {
30
- event: 'play' | 'pause' | 'ended' | 'muted' | 'unmuted' | 'buffering' | 'playing' | 'onEnterFullScreen' | 'onExitFullScreen';
31
- }
32
- interface Props {
33
- style?: ViewStyle;
34
- children?: React.ReactNode;
35
- hideUI?: boolean;
36
- contentId: string;
37
- muted?: boolean;
38
- autoplay?: boolean;
39
- startTime?: number;
40
- subtitle?: String | null;
41
- playbackRate?: 0.25 | 0.5 | 1.0 | 1.25 | 1.5 | 2.0;
42
- onPlayerEvent?: (event: {
43
- nativeEvent: PlayerEventTimeUpdate | PlayerEvent | PlayerEventDurationUpdate | PlayerEventSubtitlesAvailable | PlayerEventSubtitleSelected | PlayerEventPlaybackRateSelected | PlayerEventMedataLoaded;
44
- }) => void;
45
- }
46
- export declare const play: (ref: any) => void;
47
- export declare const pause: (ref: any) => void;
48
- export declare const seekTo: (ref: any, time: number) => void;
49
- declare class SpallaPlayer extends React.Component<Props> {
50
- _player: null;
51
- _setRef: (ref: any) => void;
52
- render(): import("react/jsx-runtime").JSX.Element;
53
- play: () => void;
54
- pause: () => void;
55
- seekTo: (time: number) => void;
56
- componentWillUnmount(): void;
57
- }
58
- export declare const initialize: (token: String, applicationId: String | null) => void;
59
- export default SpallaPlayer;
60
- export { default as SpallaCastButton } from './components/CastButton';
61
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,KAAK,SAAS,EAGf,MAAM,cAAc,CAAC;AAEtB,KAAK,oBAAoB,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,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AqB,GACrB,WAAW,GACX,yBAAyB,GACzB,6BAA6B,GAC7B,2BAA2B,GAC3B,+BAA+B,GAC/B,uBAAuB,CAAC;KAC7B,KAAK,IAAI,CAAC;CACZ;AAED,eAAO,MAAM,IAAI,QAAS,GAAG,SAG5B,CAAC;AAEF,eAAO,MAAM,KAAK,QAAS,GAAG,SAG7B,CAAC;AAEF,eAAO,MAAM,MAAM,QAAS,GAAG,QAAQ,MAAM,SAG5C,CAAC;AAIF,cAAM,YAAa,SAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;IAC/C,OAAO,OAAQ;IAEf,OAAO,QAAS,GAAG,UAEjB;IAEF,MAAM;IAiBN,IAAI,aAGF;IAEF,KAAK,aAGH;IAEF,MAAM,SAAU,MAAM,UAGpB;IAEF,oBAAoB;CAIrB;AAED,eAAO,MAAM,UAAU,UAAW,MAAM,iBAAiB,MAAM,GAAG,IAAI,SAErE,CAAC;AAEF,eAAe,YAAY,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,13 +0,0 @@
1
- import { type ViewProps } from 'react-native';
2
- export interface Props extends ViewProps {
3
- style?: ViewProps['style'] & {
4
- tintColor?: string;
5
- };
6
- tintColor?: string;
7
- }
8
- declare function CastButton({ style, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
9
- declare namespace CastButton {
10
- var propTypes: {};
11
- }
12
- export default CastButton;
13
- //# sourceMappingURL=CastButton.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CastButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/CastButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,KAAM,SAAQ,SAAS;IACtC,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,SAAS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