react-native-spalla-player 0.13.2 → 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 +33 -39
  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,158 @@
1
+ #import "SpallaPlayerView.h"
2
+
3
+ #import <react/renderer/components/SpallaPlayerViewSpec/ComponentDescriptors.h>
4
+ #import <react/renderer/components/SpallaPlayerViewSpec/EventEmitters.h>
5
+ #import <react/renderer/components/SpallaPlayerViewSpec/Props.h>
6
+ #import <react/renderer/components/SpallaPlayerViewSpec/RCTComponentViewHelpers.h>
7
+
8
+ #import "RCTFabricComponentsPlugins.h"
9
+ #import "SpallaPlayer-Swift.h"
10
+
11
+
12
+ using namespace facebook::react;
13
+
14
+ @interface SpallaPlayerView () <RCTSpallaPlayerViewViewProtocol>
15
+
16
+ @end
17
+
18
+ @implementation SpallaPlayerView {
19
+ SpallaPlayerWrapper * _view;
20
+ }
21
+
22
+ + (ComponentDescriptorProvider)componentDescriptorProvider
23
+ {
24
+ return concreteComponentDescriptorProvider<SpallaPlayerViewComponentDescriptor>();
25
+ }
26
+
27
+ - (instancetype)initWithFrame:(CGRect)frame
28
+ {
29
+ if (self = [super initWithFrame:frame]) {
30
+ static const auto defaultProps = std::make_shared<const SpallaPlayerViewProps>();
31
+ _props = defaultProps;
32
+
33
+ [self ensureFreshWrapper];
34
+ }
35
+
36
+ return self;
37
+ }
38
+
39
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
40
+ {
41
+ const auto &oldViewProps = *std::static_pointer_cast<SpallaPlayerViewProps const>(_props);
42
+ const auto &newViewProps = *std::static_pointer_cast<SpallaPlayerViewProps const>(props);
43
+
44
+ BOOL didRefresh = [self ensureFreshWrapper];
45
+
46
+ if (oldViewProps.contentId != newViewProps.contentId || didRefresh) {
47
+ [_view setContentId: [[NSString alloc] initWithUTF8String: newViewProps.contentId.c_str()]];
48
+ }
49
+
50
+ if (oldViewProps.startTime != newViewProps.startTime || didRefresh) {
51
+ [_view setStartTime: [NSNumber numberWithDouble: newViewProps.startTime]];
52
+ }
53
+
54
+ if (oldViewProps.hideUI != newViewProps.hideUI || didRefresh) {
55
+ [_view setHideUI: newViewProps.hideUI];
56
+ }
57
+
58
+ if (oldViewProps.muted != newViewProps.muted || didRefresh) {
59
+ [_view setMuted: newViewProps.muted];
60
+ }
61
+
62
+ if (oldViewProps.playbackRate != newViewProps.playbackRate || didRefresh) {
63
+ [_view setPlaybackRate: [NSNumber numberWithDouble: newViewProps.playbackRate]];
64
+ }
65
+
66
+ if (oldViewProps.subtitle != newViewProps.subtitle || didRefresh) {
67
+ // SpallaPlayerViewProps::subtitle is a std::string (not an optional), so use empty() to check for "no subtitle".
68
+ if (!newViewProps.subtitle.empty()) {
69
+ [_view setSubtitle: [[NSString alloc] initWithUTF8String: newViewProps.subtitle.c_str()]];
70
+ } else {
71
+ [_view setSubtitle: nil];
72
+ }
73
+ }
74
+
75
+ [super updateProps:props oldProps:oldProps];
76
+
77
+ }
78
+
79
+ - (BOOL)ensureFreshWrapper {
80
+ if (_view == nil) {
81
+ _view = [[SpallaPlayerWrapper alloc] init];
82
+
83
+ __weak __typeof(self) weakSelf = self;
84
+ [_view setOnPlayerEvent:^(NSDictionary<NSString *,id> * _Nonnull value) {
85
+ SpallaPlayerViewEventEmitter::OnPlayerEvent event = SpallaPlayerViewEventEmitter::OnPlayerEvent{
86
+ .event = std::string([[value objectForKey:@"event"] UTF8String]),
87
+ .duration = value[@"duration"] != nil ? [value[@"duration"] doubleValue] : 0.0,
88
+ .time = value[@"time"] != nil ? [value[@"time"] doubleValue] : 0.0,
89
+ .rate = value[@"rate"] != nil ? [value[@"rate"] doubleValue] : 0.0,
90
+ .subtitle = value[@"subtitle"] != nil ? std::string([value[@"subtitle"] UTF8String]) : std::string(),
91
+ .isLive = value[@"isLive"] != nil ? [value[@"isLive"] boolValue] : false,
92
+ .error = value[@"error"] != nil ? std::string([value[@"error"] UTF8String]) : std::string()
93
+
94
+ };
95
+ weakSelf.eventEmitter.onPlayerEvent(event);
96
+ }];
97
+
98
+ self.contentView = _view;
99
+ return YES;
100
+ }
101
+ return NO;
102
+
103
+ }
104
+
105
+ - (void)updateState:(const facebook::react::State::Shared &)state
106
+ oldState:(const facebook::react::State::Shared &)oldState {
107
+ [super updateState:state oldState:oldState];
108
+
109
+ }
110
+
111
+ - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
112
+ {
113
+ RCTSpallaPlayerViewHandleCommand(self, commandName, args);
114
+ }
115
+
116
+ - (void)pause {
117
+ [_view pause];
118
+ }
119
+
120
+ - (void)play {
121
+ [_view play];
122
+ }
123
+
124
+ - (void) seekTo:(double)time {
125
+ [_view seekToTime: time];
126
+ }
127
+
128
+ - (void) selectPlaybackRate:(float)rate {
129
+ [_view selectPlaybackRate: rate];
130
+ }
131
+
132
+ - (void) selectSubtitle:(NSString *)subtitle {
133
+ [_view selectSubtitle: subtitle];
134
+ }
135
+
136
+ - (void) unmount {
137
+ [_view unmount];
138
+ }
139
+
140
+ - (void)prepareForRecycle {
141
+ [super prepareForRecycle];
142
+
143
+ [_view setOnPlayerEvent: nil];
144
+ [_view unmount];
145
+ _view = nil;
146
+ }
147
+
148
+ - (const SpallaPlayerViewEventEmitter &)eventEmitter
149
+ {
150
+ return static_cast<const SpallaPlayerViewEventEmitter &>(*_eventEmitter);
151
+ }
152
+
153
+ Class<RCTComponentViewProtocol> SpallaPlayerViewCls(void)
154
+ {
155
+ return SpallaPlayerView.class;
156
+ }
157
+
158
+ @end
@@ -13,50 +13,53 @@ import SpallaSDK
13
13
 
14
14
  let viewController: SpallaPlayerViewController
15
15
 
16
- @objc var contentId: String? {
16
+ @objc public var contentId: String? {
17
17
  didSet {
18
18
  print("Content id: \(contentId ?? "nil")")
19
19
  // hacky! this needs to be delayed a bit so hideUI and startTime can be set first when comming from RN
20
+ // should replace with an object so all props are set at once
20
21
  DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [self] in
21
22
  self.setupPlayer()
22
23
  }
23
24
  }
24
25
  }
25
26
 
26
- @objc var muted: Bool = false {
27
+
28
+ @objc public var muted: Bool = false {
27
29
  didSet {
28
30
  print("Mute called \(muted)")
29
31
  updateMutedState()
30
32
  }
31
33
  }
32
34
 
33
- @objc var hideUI: Bool = false {
35
+ @objc public var hideUI: Bool = false {
34
36
  didSet {
35
37
  print("Hide UI set to \(hideUI)")
36
38
  }
37
39
  }
38
40
 
39
41
 
40
- @objc var startTime: NSNumber = 10 {
42
+ @objc public var startTime: NSNumber = 0.0 {
41
43
  didSet {
42
44
  print("Start time set \(startTime)")
43
45
  }
44
46
  }
45
47
 
46
- @objc var subtitle: String? = nil {
48
+ @objc public var subtitle: String? = nil {
47
49
  didSet {
48
50
  print("Subtitle set \(subtitle ?? "nil")")
49
51
  viewController.selectSubtitle(subtitle: subtitle)
50
52
  }
51
53
  }
52
54
 
53
- @objc var playbackRate: NSNumber = 1.0 {
55
+ @objc public var playbackRate: NSNumber = 1.0 {
54
56
  didSet {
55
57
  viewController.setPlaybackRate(rate: playbackRate.doubleValue)
56
58
  }
57
59
  }
58
60
 
59
- @objc var onPlayerEvent: RCTBubblingEventBlock?
61
+ @objc public var onPlayerEvent: (([String: Any]) -> Void)?
62
+
60
63
 
61
64
  convenience public init() {
62
65
  self.init(frame: CGRect.zero)
@@ -129,8 +132,9 @@ import SpallaSDK
129
132
  }
130
133
 
131
134
  @objc public func unmount() {
135
+ print("Unmount called")
132
136
  viewController.pause()
133
- viewController.removeFromParent()
137
+ //viewController.removeFromParent()
134
138
  }
135
139
 
136
140
  deinit {
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+ export default TurboModuleRegistry.getEnforcing('SpallaPlayerModule');
5
+ //# sourceMappingURL=NativeSpallaPlayerModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeSpallaPlayerModule.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAYlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,oBAAoB,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ import { codegenNativeComponent, codegenNativeCommands } from 'react-native';
4
+
5
+ // Define a single comprehensive event payload interface
6
+
7
+ export const Commands = codegenNativeCommands({
8
+ supportedCommands: ['play', 'pause', 'seekTo', 'selectSubtitle', 'selectPlaybackRate', 'unmount']
9
+ });
10
+ export default codegenNativeComponent('SpallaPlayerView');
11
+ //# sourceMappingURL=SpallaPlayerViewNativeComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["codegenNativeComponent","codegenNativeCommands","Commands","supportedCommands"],"sourceRoot":"../../src","sources":["SpallaPlayerViewNativeComponent.ts"],"mappings":";;AAAA,SACEA,sBAAsB,EAItBC,qBAAqB,QAChB,cAAc;;AAErB;;AAyCA,OAAO,MAAMC,QAAwB,GAAGD,qBAAqB,CAAiB;EAC5EE,iBAAiB,EAAE,CACjB,MAAM,EACN,OAAO,EACP,QAAQ,EACR,gBAAgB,EAChB,oBAAoB,EACpB,SAAS;AAEb,CAAC,CAAC;AAEF,eAAeH,sBAAsB,CAAc,kBAAkB,CAAC","ignoreList":[]}
@@ -1,67 +1,60 @@
1
1
  "use strict";
2
2
 
3
3
  import React from 'react';
4
- import { requireNativeComponent, NativeModules, findNodeHandle } from 'react-native';
4
+ import { Commands } from "./SpallaPlayerViewNativeComponent.js";
5
+
6
+ // Import the appropriate component based on architecture
5
7
  import { jsx as _jsx } from "react/jsx-runtime";
6
- const RNSpallaPlayer = requireNativeComponent('RNSpallaPlayer');
7
- const RNSpallaPlayerModule = NativeModules.RNSpallaPlayer;
8
- export const play = ref => {
9
- const handle = findNodeHandle(ref);
10
- RNSpallaPlayerModule.play(handle);
11
- };
12
- export const pause = ref => {
13
- const handle = findNodeHandle(ref);
14
- RNSpallaPlayerModule.pause(handle);
15
- };
16
- export const seekTo = (ref, time) => {
17
- const handle = findNodeHandle(ref);
18
- RNSpallaPlayerModule.seekTo(handle, time);
19
- };
8
+ const isFabricEnabled = global?.nativeFabricUIManager != null;
9
+ const RNSpallaPlayer = isFabricEnabled ? require('./SpallaPlayerViewNativeComponent').default : require('react-native').requireNativeComponent('RNSpallaPlayer');
10
+
11
+ // Import the appropriate module
12
+ const RNSpallaPlayerModule = isFabricEnabled ? require('./NativeSpallaPlayerModule').default : require('react-native').NativeModules.RNSpallaPlayer;
20
13
 
21
- //export default SpallaPlayer;
14
+ // Event interfaces (keep these as they are)
22
15
 
23
- class SpallaPlayer extends React.Component {
24
- _player = null;
25
- _setRef = ref => {
26
- this._player = ref;
27
- };
28
- render() {
29
- const {
30
- style,
31
- startTime,
32
- playbackRate,
33
- hideUI
34
- } = this.props;
35
- return /*#__PURE__*/_jsx(RNSpallaPlayer, {
36
- ...this.props,
37
- ref: this._setRef,
38
- style: style,
39
- startTime: startTime ?? 0,
40
- playbackRate: playbackRate ?? 1.0,
41
- hideUI: hideUI ?? false,
42
- children: this.props.children
43
- });
44
- }
45
- play = () => {
46
- const handle = findNodeHandle(this._player);
47
- RNSpallaPlayerModule.play(handle);
48
- };
49
- pause = () => {
50
- const handle = findNodeHandle(this._player);
51
- RNSpallaPlayerModule.pause(handle);
52
- };
53
- seekTo = time => {
54
- const handle = findNodeHandle(this._player);
55
- RNSpallaPlayerModule.seekTo(handle, time);
56
- };
57
- componentWillUnmount() {
58
- const handle = findNodeHandle(this._player);
59
- RNSpallaPlayerModule.unmount(handle);
60
- }
61
- }
62
16
  export const initialize = (token, applicationId) => {
63
17
  RNSpallaPlayerModule.initialize(token, applicationId);
64
18
  };
19
+ const SpallaPlayer = /*#__PURE__*/React.forwardRef((props, ref) => {
20
+ const playerRef = React.useRef(null);
21
+ React.useImperativeHandle(ref, () => ({
22
+ play: () => {
23
+ if (playerRef.current) {
24
+ Commands.play(playerRef.current);
25
+ }
26
+ },
27
+ pause: () => {
28
+ console.log('Calling pause command');
29
+ if (playerRef.current) {
30
+ Commands.pause(playerRef.current);
31
+ }
32
+ },
33
+ seekTo: time => {
34
+ if (playerRef.current) {
35
+ Commands.seekTo(playerRef.current, time);
36
+ }
37
+ }
38
+ }), []);
39
+ React.useEffect(() => {
40
+ const currentRef = playerRef.current;
41
+ return () => {
42
+ if (currentRef) {
43
+ Commands.unmount(currentRef);
44
+ }
45
+ };
46
+ }, []);
47
+ return /*#__PURE__*/_jsx(RNSpallaPlayer, {
48
+ ...props,
49
+ ref: playerRef,
50
+ style: props.style,
51
+ startTime: props.startTime ?? 0,
52
+ playbackRate: props.playbackRate ?? 1.0,
53
+ hideUI: props.hideUI ?? false,
54
+ children: props.children
55
+ });
56
+ });
57
+ SpallaPlayer.displayName = 'SpallaPlayer';
65
58
  export default SpallaPlayer;
66
59
  export { default as SpallaCastButton } from "./components/CastButton.js";
67
60
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","requireNativeComponent","NativeModules","findNodeHandle","jsx","_jsx","RNSpallaPlayer","RNSpallaPlayerModule","play","ref","handle","pause","seekTo","time","SpallaPlayer","Component","_player","_setRef","render","style","startTime","playbackRate","hideUI","props","children","componentWillUnmount","unmount","initialize","token","applicationId","default","SpallaCastButton"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,sBAAsB,EAEtBC,aAAa,EACbC,cAAc,QACT,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AActB,MAAMC,cAAc,GAClBL,sBAAsB,CAAsB,gBAAgB,CAAC;AAE/D,MAAMM,oBAAoB,GAAGL,aAAa,CAACI,cAAc;AAoEzD,OAAO,MAAME,IAAI,GAAIC,GAAQ,IAAK;EAChC,MAAMC,MAAM,GAAGP,cAAc,CAACM,GAAG,CAAC;EAClCF,oBAAoB,CAACC,IAAI,CAACE,MAAM,CAAC;AACnC,CAAC;AAED,OAAO,MAAMC,KAAK,GAAIF,GAAQ,IAAK;EACjC,MAAMC,MAAM,GAAGP,cAAc,CAACM,GAAG,CAAC;EAClCF,oBAAoB,CAACI,KAAK,CAACD,MAAM,CAAC;AACpC,CAAC;AAED,OAAO,MAAME,MAAM,GAAGA,CAACH,GAAQ,EAAEI,IAAY,KAAK;EAChD,MAAMH,MAAM,GAAGP,cAAc,CAACM,GAAG,CAAC;EAClCF,oBAAoB,CAACK,MAAM,CAACF,MAAM,EAAEG,IAAI,CAAC;AAC3C,CAAC;;AAED;;AAEA,MAAMC,YAAY,SAASd,KAAK,CAACe,SAAS,CAAQ;EAChDC,OAAO,GAAG,IAAI;EAEdC,OAAO,GAAIR,GAAQ,IAAK;IACtB,IAAI,CAACO,OAAO,GAAGP,GAAG;EACpB,CAAC;EAEDS,MAAMA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AAgB,QAAQ,4BAAyB","ignoreList":[]}
1
+ {"version":3,"names":["React","Commands","jsx","_jsx","isFabricEnabled","global","nativeFabricUIManager","RNSpallaPlayer","require","default","requireNativeComponent","RNSpallaPlayerModule","NativeModules","initialize","token","applicationId","SpallaPlayer","forwardRef","props","ref","playerRef","useRef","useImperativeHandle","play","current","pause","console","log","seekTo","time","useEffect","currentRef","unmount","style","startTime","playbackRate","hideUI","children","displayName","SpallaCastButton"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,QAAQ,QAAQ,sCAAmC;;AAE5D;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,MAAMC,eAAe,GAAIC,MAAM,EAAUC,qBAAqB,IAAI,IAAI;AAEtE,MAAMC,cAAc,GAAGH,eAAe,GAClCI,OAAO,CAAC,mCAAmC,CAAC,CAACC,OAAO,GACpDD,OAAO,CAAC,cAAc,CAAC,CAACE,sBAAsB,CAAC,gBAAgB,CAAC;;AAEpE;AACA,MAAMC,oBAAoB,GAAGP,eAAe,GACxCI,OAAO,CAAC,4BAA4B,CAAC,CAACC,OAAO,GAC7CD,OAAO,CAAC,cAAc,CAAC,CAACI,aAAa,CAACL,cAAc;;AAIxD;;AAmEA,OAAO,MAAMM,UAAU,GAAGA,CAACC,KAAa,EAAEC,aAA4B,KAAK;EACzEJ,oBAAoB,CAACE,UAAU,CAACC,KAAK,EAAEC,aAAa,CAAC;AACvD,CAAC;AAQD,MAAMC,YAAY,gBAAGhB,KAAK,CAACiB,UAAU,CAAyB,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC5E,MAAMC,SAAS,GAAGpB,KAAK,CAACqB,MAAM,CAAC,IAAI,CAAC;EAEpCrB,KAAK,CAACsB,mBAAmB,CACvBH,GAAG,EACH,OAAO;IACLI,IAAI,EAAEA,CAAA,KAAM;MACV,IAAIH,SAAS,CAACI,OAAO,EAAE;QACrBvB,QAAQ,CAACsB,IAAI,CAACH,SAAS,CAACI,OAAO,CAAC;MAClC;IACF,CAAC;IACDC,KAAK,EAAEA,CAAA,KAAM;MACXC,OAAO,CAACC,GAAG,CAAC,uBAAuB,CAAC;MACpC,IAAIP,SAAS,CAACI,OAAO,EAAE;QACrBvB,QAAQ,CAACwB,KAAK,CAACL,SAAS,CAACI,OAAO,CAAC;MACnC;IACF,CAAC;IACDI,MAAM,EAAGC,IAAY,IAAK;MACxB,IAAIT,SAAS,CAACI,OAAO,EAAE;QACrBvB,QAAQ,CAAC2B,MAAM,CAACR,SAAS,CAACI,OAAO,EAAEK,IAAI,CAAC;MAC1C;IACF;EACF,CAAC,CAAC,EACF,EACF,CAAC;EAED7B,KAAK,CAAC8B,SAAS,CAAC,MAAM;IACpB,MAAMC,UAAU,GAAGX,SAAS,CAACI,OAAO;IACpC,OAAO,MAAM;MACX,IAAIO,UAAU,EAAE;QACd9B,QAAQ,CAAC+B,OAAO,CAACD,UAAU,CAAC;MAC9B;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,oBACE5B,IAAA,CAACI,cAAc;IAAA,GACTW,KAAK;IACTC,GAAG,EAAEC,SAAU;IACfa,KAAK,EAAEf,KAAK,CAACe,KAAM;IACnBC,SAAS,EAAEhB,KAAK,CAACgB,SAAS,IAAI,CAAE;IAChCC,YAAY,EAAEjB,KAAK,CAACiB,YAAY,IAAI,GAAI;IACxCC,MAAM,EAAElB,KAAK,CAACkB,MAAM,IAAI,KAAM;IAAAC,QAAA,EAE7BnB,KAAK,CAACmB;EAAQ,CACD,CAAC;AAErB,CAAC,CAAC;AAEFrB,YAAY,CAACsB,WAAW,GAAG,cAAc;AAEzC,eAAetB,YAAY;AAC3B,SAASP,OAAO,IAAI8B,gBAAgB,QAAQ,4BAAyB","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import type { TurboModule, CodegenTypes } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ play(tag: CodegenTypes.Int32): void;
4
+ pause(tag: CodegenTypes.Int32): void;
5
+ seekTo(tag: CodegenTypes.Int32, time: number): void;
6
+ selectSubtitle(tag: CodegenTypes.Int32, subtitle: string | null): void;
7
+ selectPlaybackRate(tag: CodegenTypes.Int32, rate: number): void;
8
+ unmount(tag: CodegenTypes.Int32): void;
9
+ initialize(token: string, applicationId: string): void;
10
+ }
11
+ declare const _default: Spec;
12
+ export default _default;
13
+ //# sourceMappingURL=NativeSpallaPlayerModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeSpallaPlayerModule.d.ts","sourceRoot":"","sources":["../../../src/NativeSpallaPlayerModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG9D,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,GAAG,IAAI,CAAC;IACrC,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpD,cAAc,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACvE,kBAAkB,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAChE,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,GAAG,IAAI,CAAC;IACvC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CACxD;;AAED,wBAA4E"}
@@ -0,0 +1,33 @@
1
+ import { type ViewProps, type CodegenTypes, type HostComponent } from 'react-native';
2
+ interface PlayerEventPayload {
3
+ event: string;
4
+ time?: CodegenTypes.Double;
5
+ duration?: CodegenTypes.Double;
6
+ isLive?: boolean;
7
+ subtitles?: string[];
8
+ subtitle?: string;
9
+ rate?: CodegenTypes.Float;
10
+ message?: string;
11
+ error?: string;
12
+ }
13
+ export interface NativeProps extends ViewProps {
14
+ contentId?: string;
15
+ muted?: boolean;
16
+ startTime?: CodegenTypes.Double;
17
+ subtitle?: string | null;
18
+ playbackRate?: CodegenTypes.Float;
19
+ hideUI?: boolean;
20
+ onPlayerEvent?: CodegenTypes.BubblingEventHandler<PlayerEventPayload>;
21
+ }
22
+ export interface NativeCommands {
23
+ play: (viewRef: React.ElementRef<HostComponent<any>>) => void;
24
+ pause: (viewRef: React.ElementRef<HostComponent<any>>) => void;
25
+ seekTo: (viewRef: React.ElementRef<HostComponent<any>>, time: CodegenTypes.Double) => void;
26
+ selectSubtitle: (viewRef: React.ElementRef<HostComponent<any>>, subtitle: string | null) => void;
27
+ selectPlaybackRate: (viewRef: React.ElementRef<HostComponent<any>>, rate: CodegenTypes.Float) => void;
28
+ unmount: (viewRef: React.ElementRef<HostComponent<any>>) => void;
29
+ }
30
+ export declare const Commands: NativeCommands;
31
+ declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
32
+ export default _default;
33
+ //# sourceMappingURL=SpallaPlayerViewNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpallaPlayerViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/SpallaPlayerViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,aAAa,EAEnB,MAAM,cAAc,CAAC;AAGtB,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;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C,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC;CAClE;AAED,eAAO,MAAM,QAAQ,EAAE,cASrB,CAAC;;AAEH,wBAAuE"}
@@ -0,0 +1 @@
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"}
@@ -38,24 +38,18 @@ interface Props {
38
38
  autoplay?: boolean;
39
39
  startTime?: number;
40
40
  subtitle?: String | null;
41
- playbackRate?: 0.25 | 0.5 | 1.0 | 1.25 | 1.5 | 2.0;
41
+ playbackRate?: allowedPlaybackRates;
42
42
  onPlayerEvent?: (event: {
43
- nativeEvent: PlayerEventTimeUpdate | PlayerEvent | PlayerEventDurationUpdate | PlayerEventSubtitlesAvailable | PlayerEventSubtitleSelected | PlayerEventPlaybackRateSelected | PlayerEventMedataLoaded;
43
+ nativeEvent: PlayerEvent | PlayerEventTimeUpdate | PlayerEventDurationUpdate | PlayerEventSubtitlesAvailable | PlayerEventSubtitleSelected | PlayerEventPlaybackRateSelected | PlayerEventMedataLoaded;
44
44
  }) => void;
45
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;
46
+ export declare const initialize: (token: string, applicationId: string | null) => void;
47
+ export interface SpallaPlayerRef {
48
+ play(): void;
49
+ pause(): void;
50
+ seekTo(time: number): void;
51
+ }
52
+ declare const SpallaPlayer: React.ForwardRefExoticComponent<Props & React.RefAttributes<SpallaPlayerRef>>;
59
53
  export default SpallaPlayer;
60
54
  export { default as SpallaCastButton } from './components/CastButton';
61
55
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAe9C,KAAK,oBAAoB,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;AAGhE,UAAU,qBAAqB;IAC7B,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,yBAAyB;IACjC,KAAK,EAAE,gBAAgB,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,6BAA6B;IACrC,KAAK,EAAE,oBAAoB,CAAC;IAC5B,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC1B;AAED,UAAU,2BAA2B;IACnC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,+BAA+B;IACvC,KAAK,EAAE,sBAAsB,CAAC;IAC9B,IAAI,EAAE,oBAAoB,CAAC;CAC5B;AAED,UAAU,uBAAuB;IAC/B,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,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