react-native-spalla-player 0.5.1 → 0.6.1
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 +44 -0
- package/android/build.gradle +8 -1
- package/android/src/main/java/com/spallaplayer/SpallaPlayerPackage.kt +2 -1
- package/android/src/main/java/com/spallaplayer/SpallaPlayerViewManager.kt +17 -1
- package/android/src/main/java/com/spallaplayer/components/RNGoogleCastButtonManager.java +117 -0
- package/ios/RNSpallaPlayer.m +2 -0
- package/ios/SpallaPlayerWrapper.swift +28 -9
- package/ios/components/RNGoogleCastButton.h +6 -0
- package/ios/components/RNGoogleCastButton.m +34 -0
- package/lib/commonjs/components/CastButton.js +49 -0
- package/lib/commonjs/components/CastButton.js.map +1 -0
- package/lib/commonjs/index.js +10 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/CastButton.js +45 -0
- package/lib/module/components/CastButton.js.map +1 -0
- package/lib/module/index.js +4 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/components/CastButton.d.ts +13 -0
- package/lib/typescript/commonjs/src/components/CastButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/CastButton.d.ts +13 -0
- package/lib/typescript/module/src/components/CastButton.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +2 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-spalla-player.podspec +1 -1
- package/src/components/CastButton.tsx +49 -0
- package/src/index.tsx +10 -4
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ repositories {
|
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
|
|
26
27
|
## Usage
|
|
27
28
|
|
|
28
29
|
```js
|
|
@@ -100,6 +101,7 @@ const [playing, setPlaying] = React.useState(true);
|
|
|
100
101
|
| **`contentId`** | string | Spalla contentId that will be played
|
|
101
102
|
| **`hideUI`** | boolean | hide or show the default UI (its a prop, but it can only be set once)
|
|
102
103
|
| **`muted`** | boolean | mute/unmute video
|
|
104
|
+
| **`startTime`** | number | time to start the video in seconds (defaults to 0 = start of the video)
|
|
103
105
|
| **`onPlayerEvent`**| callback | Function that will be called with player events
|
|
104
106
|
|
|
105
107
|
## Imperative Methods
|
|
@@ -118,6 +120,48 @@ playerRef.current?.pause();
|
|
|
118
120
|
playerRef.current?.seekTo(12); //position in seconds, if higher than duration it will move to the end
|
|
119
121
|
```
|
|
120
122
|
|
|
123
|
+
## Chromecast
|
|
124
|
+
|
|
125
|
+
If you are using Chromecast, there are a few changes that needs to be done:
|
|
126
|
+
|
|
127
|
+
```js
|
|
128
|
+
// Add the application id for chromecast. In this example, A123456
|
|
129
|
+
initialize(
|
|
130
|
+
'your spalla token',
|
|
131
|
+
'A123456'
|
|
132
|
+
);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
On iOS, open Xcode, open info.plist file as SourceCode, and copy this inside the main dict. Make sure to change A123456 with your App ID (keep the underscore at the start). More details on this [link](https://developers.google.com/cast/docs/ios_sender/permissions_and_discovery#updating_your_app_on_ios_14) if needed.
|
|
136
|
+
```
|
|
137
|
+
<key>NSBonjourServices</key>
|
|
138
|
+
<array>
|
|
139
|
+
<string>_googlecast._tcp</string>
|
|
140
|
+
<string>_A123456._googlecast._tcp</string>
|
|
141
|
+
</array>
|
|
142
|
+
<key>NSLocalNetworkUsageDescription</key>
|
|
143
|
+
<string>We need network access to search for Cast devices</string>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
On Android, open Manifest.xml and add this meta data tag inside the <application> tag (same level as activities). As before, change A123456 with your App ID.
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
<meta-data
|
|
150
|
+
android:name="com.spalla.sdk.CAST_ID"
|
|
151
|
+
android:value="A123456"/>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Spalla provides a RN View that you can use to add the cast button to your interface. Check the example app if you need an example of usage
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
import { SpallaCastButton } from 'react-native-spalla-player';
|
|
158
|
+
|
|
159
|
+
[...]
|
|
160
|
+
|
|
161
|
+
return <SpallaCastButton tintColor="white" />
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
|
|
121
165
|
## Contributing
|
|
122
166
|
|
|
123
167
|
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
package/android/build.gradle
CHANGED
|
@@ -39,6 +39,11 @@ def getExtOrIntegerDefault(name) {
|
|
|
39
39
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["SpallaPlayer_" + name]).toInteger()
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
def safeExtGet(prop, fallback) {
|
|
43
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
42
47
|
def supportsNamespace() {
|
|
43
48
|
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
44
49
|
def major = parsed[0].toInteger()
|
|
@@ -97,7 +102,9 @@ dependencies {
|
|
|
97
102
|
//noinspection GradleDynamicVersion
|
|
98
103
|
implementation "com.facebook.react:react-native:+"
|
|
99
104
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
100
|
-
implementation
|
|
105
|
+
implementation "androidx.mediarouter:mediarouter:1.2.0"
|
|
106
|
+
implementation "stream.spalla:spalla-android-sdk:1.5.0"
|
|
107
|
+
implementation "com.google.android.gms:play-services-cast-framework:21.3.0"
|
|
101
108
|
}
|
|
102
109
|
|
|
103
110
|
|
|
@@ -4,6 +4,7 @@ import com.facebook.react.ReactPackage
|
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.uimanager.ViewManager
|
|
7
|
+
import com.spallaplayer.components.RNGoogleCastButtonManager
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class SpallaPlayerPackage : ReactPackage {
|
|
@@ -12,6 +13,6 @@ class SpallaPlayerPackage : ReactPackage {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
15
|
-
return listOf(RNSpallaPlayerManager())
|
|
16
|
+
return listOf(RNSpallaPlayerManager(), RNGoogleCastButtonManager())
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -18,6 +18,9 @@ class RNSpallaPlayerManager() : SimpleViewManager<SpallaPlayerView>(), SpallaPla
|
|
|
18
18
|
private var _playerView: SpallaPlayerView? = null
|
|
19
19
|
private var _reactContext: ReactContext? = null
|
|
20
20
|
|
|
21
|
+
private var contentId: String? = null
|
|
22
|
+
private var startTime: Double? = null
|
|
23
|
+
|
|
21
24
|
override fun getName() = "RNSpallaPlayer"
|
|
22
25
|
|
|
23
26
|
override fun createViewInstance(context: ThemedReactContext): SpallaPlayerView {
|
|
@@ -54,7 +57,8 @@ class RNSpallaPlayerManager() : SimpleViewManager<SpallaPlayerView>(), SpallaPla
|
|
|
54
57
|
|
|
55
58
|
@ReactProp(name = "contentId")
|
|
56
59
|
fun setContentId(view: SpallaPlayerView, contentId: String) {
|
|
57
|
-
|
|
60
|
+
this.contentId = contentId
|
|
61
|
+
checkAndLoadPlayer(view)
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
@ReactProp(name = "muted")
|
|
@@ -62,6 +66,18 @@ class RNSpallaPlayerManager() : SimpleViewManager<SpallaPlayerView>(), SpallaPla
|
|
|
62
66
|
_playerView?.setMuted(muted)
|
|
63
67
|
}
|
|
64
68
|
|
|
69
|
+
@ReactProp(name = "startTime")
|
|
70
|
+
fun setStartTime(view: SpallaPlayerView, startTime: Double) {
|
|
71
|
+
this.startTime = startTime
|
|
72
|
+
checkAndLoadPlayer(view)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private fun checkAndLoadPlayer(view: SpallaPlayerView) {
|
|
76
|
+
if (contentId != null && startTime != null) {
|
|
77
|
+
view.load(contentId!!, false, true, startTime!!)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
65
81
|
override fun onEvent( spallaPlayerEvent: SpallaPlayerEvent) {
|
|
66
82
|
val map: WritableMap = Arguments.createMap()
|
|
67
83
|
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
package com.spallaplayer.components;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.content.res.TypedArray;
|
|
5
|
+
import android.graphics.drawable.Drawable;
|
|
6
|
+
import android.util.AttributeSet;
|
|
7
|
+
import android.view.ContextThemeWrapper;
|
|
8
|
+
import android.view.View;
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.NonNull;
|
|
11
|
+
import androidx.annotation.Nullable;
|
|
12
|
+
import androidx.core.graphics.drawable.DrawableCompat;
|
|
13
|
+
import androidx.mediarouter.app.MediaRouteButton;
|
|
14
|
+
|
|
15
|
+
import com.facebook.react.uimanager.SimpleViewManager;
|
|
16
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
17
|
+
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
18
|
+
import com.google.android.gms.cast.framework.CastButtonFactory;
|
|
19
|
+
import com.google.android.gms.cast.framework.CastContext;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
import java.util.ArrayList;
|
|
23
|
+
import java.util.List;
|
|
24
|
+
|
|
25
|
+
public class RNGoogleCastButtonManager
|
|
26
|
+
extends SimpleViewManager<MediaRouteButton> {
|
|
27
|
+
|
|
28
|
+
public static final String REACT_CLASS = "RNGoogleCastButton";
|
|
29
|
+
private Integer mColor = null;
|
|
30
|
+
|
|
31
|
+
protected static List<MediaRouteButton> currentInstances = new ArrayList<>();
|
|
32
|
+
|
|
33
|
+
// there can be multiple screens that have a cast button, we use the latest one
|
|
34
|
+
public static @Nullable MediaRouteButton getCurrent() {
|
|
35
|
+
if (currentInstances.size() == 0) return null;
|
|
36
|
+
return currentInstances.get(currentInstances.size() - 1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@Override
|
|
40
|
+
public @NonNull String getName() {
|
|
41
|
+
return REACT_CLASS;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Override
|
|
45
|
+
public @NonNull MediaRouteButton createViewInstance(@NonNull ThemedReactContext context) {
|
|
46
|
+
final MediaRouteButton button = new ColorableMediaRouteButton(context);
|
|
47
|
+
|
|
48
|
+
Context contextThemeWrapper = new ContextThemeWrapper(context, androidx.mediarouter.R.style.Theme_MediaRouter);
|
|
49
|
+
TypedArray styleAttrs = contextThemeWrapper.obtainStyledAttributes(null, androidx.mediarouter.R.styleable.MediaRouteButton, androidx.mediarouter.R.attr.mediaRouteButtonStyle, 0);
|
|
50
|
+
Drawable drawable = styleAttrs.getDrawable(androidx.mediarouter.R.styleable.MediaRouteButton_externalRouteEnabledDrawable);
|
|
51
|
+
styleAttrs.recycle();
|
|
52
|
+
|
|
53
|
+
// the drawable needs to be set before calling CastButtonFactory.setupMediaRouteButton()
|
|
54
|
+
// otherwise it won't initiate with the correct visual state
|
|
55
|
+
button.setRemoteIndicatorDrawable(drawable);
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
CastContext.getSharedInstance(context);
|
|
59
|
+
CastButtonFactory.setUpMediaRouteButton(context, button);
|
|
60
|
+
} catch (Exception e) {
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return button;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@ReactProp(name = "tintColor", customType = "Color")
|
|
67
|
+
public void setTintColor(ColorableMediaRouteButton button, Integer color) {
|
|
68
|
+
if (color == null)
|
|
69
|
+
return;
|
|
70
|
+
button.applyTint(color);
|
|
71
|
+
mColor = color;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// https://stackoverflow.com/a/41496796/384349
|
|
75
|
+
private class ColorableMediaRouteButton extends MediaRouteButton {
|
|
76
|
+
protected Drawable mRemoteIndicatorDrawable;
|
|
77
|
+
|
|
78
|
+
public ColorableMediaRouteButton(Context context) { super(context); }
|
|
79
|
+
|
|
80
|
+
public ColorableMediaRouteButton(Context context, AttributeSet attrs) {
|
|
81
|
+
super(context, attrs);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public ColorableMediaRouteButton(Context context, AttributeSet attrs,
|
|
85
|
+
int defStyleAttr) {
|
|
86
|
+
super(context, attrs, defStyleAttr);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@Override
|
|
90
|
+
public void setRemoteIndicatorDrawable(Drawable d) {
|
|
91
|
+
mRemoteIndicatorDrawable = d;
|
|
92
|
+
super.setRemoteIndicatorDrawable(d);
|
|
93
|
+
if (mColor != null)
|
|
94
|
+
applyTint(mColor);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public void applyTint(Integer color) {
|
|
98
|
+
if (mRemoteIndicatorDrawable == null)
|
|
99
|
+
return;
|
|
100
|
+
|
|
101
|
+
Drawable wrapDrawable = DrawableCompat.wrap(mRemoteIndicatorDrawable);
|
|
102
|
+
DrawableCompat.setTint(wrapDrawable, color);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@Override
|
|
106
|
+
public void onDetachedFromWindow() {
|
|
107
|
+
super.onDetachedFromWindow();
|
|
108
|
+
RNGoogleCastButtonManager.currentInstances.remove(this);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@Override
|
|
112
|
+
public void onAttachedToWindow() {
|
|
113
|
+
super.onAttachedToWindow();
|
|
114
|
+
RNGoogleCastButtonManager.currentInstances.add(this);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
package/ios/RNSpallaPlayer.m
CHANGED
|
@@ -11,6 +11,8 @@ RCT_EXPORT_VIEW_PROPERTY(muted, BOOL)
|
|
|
11
11
|
|
|
12
12
|
RCT_EXPORT_VIEW_PROPERTY(hideUI, BOOL)
|
|
13
13
|
|
|
14
|
+
RCT_EXPORT_VIEW_PROPERTY(startTime, NSNumber)
|
|
15
|
+
|
|
14
16
|
RCT_EXPORT_METHOD(play: (nonnull NSNumber *) reactTag {
|
|
15
17
|
|
|
16
18
|
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
@@ -16,9 +16,9 @@ import SpallaSDK
|
|
|
16
16
|
@objc var contentId: String? {
|
|
17
17
|
didSet {
|
|
18
18
|
print("Content id: \(contentId ?? "nil")")
|
|
19
|
-
// hacky! this needs to be delayed a bit so hideUI can be set first when comming from RN
|
|
19
|
+
// hacky! this needs to be delayed a bit so hideUI and startTime can be set first when comming from RN
|
|
20
20
|
// ideally we should use a chromeless class
|
|
21
|
-
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
|
21
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [self] in
|
|
22
22
|
self.setupPlayer()
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -26,15 +26,23 @@ import SpallaSDK
|
|
|
26
26
|
|
|
27
27
|
@objc var muted: Bool = false {
|
|
28
28
|
didSet {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} else {
|
|
32
|
-
viewController.unmute()
|
|
33
|
-
}
|
|
29
|
+
print("Mute called \(muted)")
|
|
30
|
+
updateMutedState()
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
33
|
|
|
37
|
-
@objc var hideUI: Bool = false
|
|
34
|
+
@objc var hideUI: Bool = false {
|
|
35
|
+
didSet {
|
|
36
|
+
print("Hide UI set to \(hideUI)")
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@objc var startTime: NSNumber = 10 {
|
|
42
|
+
didSet {
|
|
43
|
+
print("Start time set \(startTime)")
|
|
44
|
+
}
|
|
45
|
+
}
|
|
38
46
|
|
|
39
47
|
@objc var onPlayerEvent: RCTBubblingEventBlock?
|
|
40
48
|
|
|
@@ -70,7 +78,8 @@ import SpallaSDK
|
|
|
70
78
|
|
|
71
79
|
func setupPlayer() {
|
|
72
80
|
if let contentId {
|
|
73
|
-
|
|
81
|
+
print("Start time \(startTime)")
|
|
82
|
+
viewController.setup(with: contentId, isLive: false, hideUI: hideUI, startTime: startTime.doubleValue)
|
|
74
83
|
}
|
|
75
84
|
}
|
|
76
85
|
|
|
@@ -86,6 +95,16 @@ import SpallaSDK
|
|
|
86
95
|
viewController.seekTo(time: TimeInterval(time))
|
|
87
96
|
}
|
|
88
97
|
|
|
98
|
+
private func updateMutedState() {
|
|
99
|
+
viewController.mute()
|
|
100
|
+
if muted {
|
|
101
|
+
viewController.mute()
|
|
102
|
+
} else {
|
|
103
|
+
viewController.unmute()
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
89
108
|
@objc static public func initialize(token: String, applicationId: String) {
|
|
90
109
|
Spalla.shared.initialize(token: token, applicationId: applicationId)
|
|
91
110
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
#import "RNGoogleCastButton.h"
|
|
3
|
+
|
|
4
|
+
@import GoogleCast;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#import "RNGoogleCastButton.h"
|
|
8
|
+
#import <React/RCTViewManager.h>
|
|
9
|
+
#import <React/RCTUIManager.h>
|
|
10
|
+
#import <React/RCTLog.h>
|
|
11
|
+
|
|
12
|
+
@implementation RNGoogleCastButton
|
|
13
|
+
|
|
14
|
+
RCT_EXPORT_MODULE(RNGoogleCastButton)
|
|
15
|
+
|
|
16
|
+
- (UIView *)view {
|
|
17
|
+
return [[GCKUICastButton alloc] init];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
- (nullable GCKUICastButton *) getWrapper: (nonnull NSNumber *)reactTag viewRegistry:(NSDictionary<NSNumber *,UIView *> *) viewRegistry {
|
|
21
|
+
UIView *view = viewRegistry[reactTag];
|
|
22
|
+
if (!view || ![view isKindOfClass:[GCKUICastButton class]]) {
|
|
23
|
+
RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
|
|
24
|
+
return NULL;
|
|
25
|
+
} else {
|
|
26
|
+
return (GCKUICastButton *) view;
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor)
|
|
33
|
+
|
|
34
|
+
@end
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,10 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "SpallaCastButton", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CastButton.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
exports.seekTo = exports.play = exports.pause = exports.initialize = exports.default = void 0;
|
|
7
13
|
var _react = _interopRequireDefault(require("react"));
|
|
8
14
|
var _reactNative = require("react-native");
|
|
9
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
var _CastButton = _interopRequireDefault(require("./components/CastButton.js"));
|
|
10
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
18
|
const RNSpallaPlayer = (0, _reactNative.requireNativeComponent)('RNSpallaPlayer');
|
|
12
19
|
const RNSpallaPlayerModule = _reactNative.NativeModules.RNSpallaPlayer;
|
|
@@ -34,15 +41,14 @@ class SpallaPlayer extends _react.default.Component {
|
|
|
34
41
|
};
|
|
35
42
|
render() {
|
|
36
43
|
const {
|
|
37
|
-
style
|
|
44
|
+
style,
|
|
45
|
+
startTime
|
|
38
46
|
} = this.props;
|
|
39
|
-
|
|
40
|
-
//const {maxHeight} = this.state;
|
|
41
|
-
|
|
42
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RNSpallaPlayer, {
|
|
43
48
|
...this.props,
|
|
44
49
|
ref: this._setRef,
|
|
45
50
|
style: style,
|
|
51
|
+
startTime: startTime ?? 0,
|
|
46
52
|
children: this.props.children
|
|
47
53
|
});
|
|
48
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_jsxRuntime","e","__esModule","default","RNSpallaPlayer","requireNativeComponent","RNSpallaPlayerModule","NativeModules","play","ref","handle","findNodeHandle","exports","pause","seekTo","time","SpallaPlayer","React","Component","_player","_setRef","render","style","props","jsx","children","initialize","token","applicationId","_default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"
|
|
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","props","jsx","children","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;AA0GtB,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAsE,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAjGtE,MAAMG,cAAc,GAClB,IAAAC,mCAAsB,EAAsB,gBAAgB,CAAC;AAE/D,MAAMC,oBAAoB,GAAGC,0BAAa,CAACH,cAAc;AAuClD,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,IAAI,CAAC;AAC3C,CAAC;;AAED;AAAAH,OAAA,CAAAE,MAAA,GAAAA,MAAA;AAEA,MAAME,YAAY,SAASC,cAAK,CAACC,SAAS,CAAQ;EAChDC,OAAO,GAAG,IAAI;EAEdC,OAAO,GAAIX,GAAQ,IAAK;IACtB,IAAI,CAACU,OAAO,GAAGV,GAAG;EACpB,CAAC;EAEDY,MAAMA,CAAA,EAAG;IACP,MAAM;MAAEC,KAAK;MAAEC;IAAU,CAAC,GAAG,IAAI,CAACC,KAAK;IAEvC,oBACE,IAAAzB,WAAA,CAAA0B,GAAA,EAACrB,cAAc;MAAA,GACT,IAAI,CAACoB,KAAK;MACdf,GAAG,EAAE,IAAI,CAACW,OAAQ;MAClBE,KAAK,EAAEA,KAAM;MACbC,SAAS,EAAEA,SAAS,IAAI,CAAE;MAAAG,QAAA,EAEzB,IAAI,CAACF,KAAK,CAACE;IAAQ,CACN,CAAC;EAErB;EAEAlB,IAAI,GAAGA,CAAA,KAAM;IACX,MAAME,MAAM,GAAG,IAAAC,2BAAc,EAAC,IAAI,CAACQ,OAAO,CAAC;IAC3Cb,oBAAoB,CAACE,IAAI,CAACE,MAAM,CAAC;EACnC,CAAC;EAEDG,KAAK,GAAGA,CAAA,KAAM;IACZ,MAAMH,MAAM,GAAG,IAAAC,2BAAc,EAAC,IAAI,CAACQ,OAAO,CAAC;IAC3Cb,oBAAoB,CAACO,KAAK,CAACH,MAAM,CAAC;EACpC,CAAC;AACH;AAEO,MAAMiB,UAAU,GAAGA,CAACC,KAAa,EAAEC,aAA4B,KAAK;EACzEvB,oBAAoB,CAACqB,UAAU,CAACC,KAAK,EAAEC,aAAa,CAAC;AACvD,CAAC;AAACjB,OAAA,CAAAe,UAAA,GAAAA,UAAA;AAAA,IAAAG,QAAA,GAAAlB,OAAA,CAAAT,OAAA,GAEaa,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { requireNativeComponent, StyleSheet } from 'react-native';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
export default function CastButton({
|
|
6
|
+
style,
|
|
7
|
+
...rest
|
|
8
|
+
}) {
|
|
9
|
+
// @ts-ignore FIXME
|
|
10
|
+
return /*#__PURE__*/_jsx(GoogleCastButton, {
|
|
11
|
+
style: [styles.default, style],
|
|
12
|
+
...rest
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
CastButton.propTypes = {
|
|
16
|
+
/**
|
|
17
|
+
* 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.
|
|
18
|
+
*
|
|
19
|
+
* 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.
|
|
20
|
+
*/
|
|
21
|
+
// triggersDefaultCastDialog: PropTypes.bool
|
|
22
|
+
// accessibilityLabel: PropTypes.string
|
|
23
|
+
};
|
|
24
|
+
const GoogleCastButton = requireNativeComponent('RNGoogleCastButton'
|
|
25
|
+
// CastButton
|
|
26
|
+
// {
|
|
27
|
+
// nativeOnly: {
|
|
28
|
+
// accessibilityLabel: true,
|
|
29
|
+
// accessibilityLiveRegion: true,
|
|
30
|
+
// accessibilityComponentType: true,
|
|
31
|
+
// testID: true,
|
|
32
|
+
// nativeID: true,
|
|
33
|
+
// importantForAccessibility: true,
|
|
34
|
+
// renderToHardwareTextureAndroid: true,
|
|
35
|
+
// onLayout: true,
|
|
36
|
+
// },
|
|
37
|
+
// }
|
|
38
|
+
);
|
|
39
|
+
const styles = StyleSheet.create({
|
|
40
|
+
default: {
|
|
41
|
+
width: 40,
|
|
42
|
+
height: 40
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=CastButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["requireNativeComponent","StyleSheet","jsx","_jsx","CastButton","style","rest","GoogleCastButton","styles","default","propTypes","create","width","height"],"sourceRoot":"../../../src","sources":["components/CastButton.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EAEtBC,UAAU,QACL,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAOtB,eAAe,SAASC,UAAUA,CAAC;EAAEC,KAAK;EAAE,GAAGC;AAAY,CAAC,EAAE;EAC5D;EACA,oBAAOH,IAAA,CAACI,gBAAgB;IAACF,KAAK,EAAE,CAACG,MAAM,CAACC,OAAO,EAAEJ,KAAK,CAAE;IAAA,GAAKC;EAAI,CAAG,CAAC;AACvE;AAEAF,UAAU,CAACM,SAAS,GAAG;EACrB;AACF;AACA;AACA;AACA;EACE;EACA;AAAA,CACD;AAED,MAAMH,gBAAgB,GAAGP,sBAAsB,CAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,CAAC;AAED,MAAMQ,MAAM,GAAGP,UAAU,CAACU,MAAM,CAAC;EAC/BF,OAAO,EAAE;IACPG,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -27,15 +27,14 @@ class SpallaPlayer extends React.Component {
|
|
|
27
27
|
};
|
|
28
28
|
render() {
|
|
29
29
|
const {
|
|
30
|
-
style
|
|
30
|
+
style,
|
|
31
|
+
startTime
|
|
31
32
|
} = this.props;
|
|
32
|
-
|
|
33
|
-
//const {maxHeight} = this.state;
|
|
34
|
-
|
|
35
33
|
return /*#__PURE__*/_jsx(RNSpallaPlayer, {
|
|
36
34
|
...this.props,
|
|
37
35
|
ref: this._setRef,
|
|
38
36
|
style: style,
|
|
37
|
+
startTime: startTime ?? 0,
|
|
39
38
|
children: this.props.children
|
|
40
39
|
});
|
|
41
40
|
}
|
|
@@ -52,4 +51,5 @@ export const initialize = (token, applicationId) => {
|
|
|
52
51
|
RNSpallaPlayerModule.initialize(token, applicationId);
|
|
53
52
|
};
|
|
54
53
|
export default SpallaPlayer;
|
|
54
|
+
export { default as SpallaCastButton } from "./components/CastButton.js";
|
|
55
55
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -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","props","children","initialize","token","applicationId"],"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;
|
|
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","props","children","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;AAStB,MAAMC,cAAc,GAClBL,sBAAsB,CAAsB,gBAAgB,CAAC;AAE/D,MAAMM,oBAAoB,GAAGL,aAAa,CAACI,cAAc;AAuCzD,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,CAAA,EAAG;IACP,MAAM;MAAEC,KAAK;MAAEC;IAAU,CAAC,GAAG,IAAI,CAACC,KAAK;IAEvC,oBACEhB,IAAA,CAACC,cAAc;MAAA,GACT,IAAI,CAACe,KAAK;MACdZ,GAAG,EAAE,IAAI,CAACQ,OAAQ;MAClBE,KAAK,EAAEA,KAAM;MACbC,SAAS,EAAEA,SAAS,IAAI,CAAE;MAAAE,QAAA,EAEzB,IAAI,CAACD,KAAK,CAACC;IAAQ,CACN,CAAC;EAErB;EAEAd,IAAI,GAAGA,CAAA,KAAM;IACX,MAAME,MAAM,GAAGP,cAAc,CAAC,IAAI,CAACa,OAAO,CAAC;IAC3CT,oBAAoB,CAACC,IAAI,CAACE,MAAM,CAAC;EACnC,CAAC;EAEDC,KAAK,GAAGA,CAAA,KAAM;IACZ,MAAMD,MAAM,GAAGP,cAAc,CAAC,IAAI,CAACa,OAAO,CAAC;IAC3CT,oBAAoB,CAACI,KAAK,CAACD,MAAM,CAAC;EACpC,CAAC;AACH;AAEA,OAAO,MAAMa,UAAU,GAAGA,CAACC,KAAa,EAAEC,aAA4B,KAAK;EACzElB,oBAAoB,CAACgB,UAAU,CAACC,KAAK,EAAEC,aAAa,CAAC;AACvD,CAAC;AAED,eAAeX,YAAY;AAC3B,SAASY,OAAO,IAAIC,gBAAgB,QAAQ,4BAAyB","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
|
@@ -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"}
|
|
@@ -18,6 +18,7 @@ interface Props {
|
|
|
18
18
|
contentId: string;
|
|
19
19
|
muted?: boolean;
|
|
20
20
|
autoplay?: boolean;
|
|
21
|
+
startTime?: number;
|
|
21
22
|
onPlayerEvent?: (event: {
|
|
22
23
|
nativeEvent: PlayerEventTimeUpdate | PlayerEvent | PlayerEventDurationUpdate;
|
|
23
24
|
}) => void;
|
|
@@ -34,4 +35,5 @@ declare class SpallaPlayer extends React.Component<Props> {
|
|
|
34
35
|
}
|
|
35
36
|
export declare const initialize: (token: String, applicationId: String | null) => void;
|
|
36
37
|
export default SpallaPlayer;
|
|
38
|
+
export { default as SpallaCastButton } from './components/CastButton';
|
|
37
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AActB,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,WAAW;IACnB,KAAK,EACD,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,SAAS,GACT,WAAW,GACX,SAAS,CAAC;CACf;AAED,UAAU,KAAK;IACb,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QACtB,WAAW,EACP,qBAAqB,GACrB,WAAW,GACX,yBAAyB,CAAC;KAC/B,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;IAeN,IAAI,aAGF;IAEF,KAAK,aAGH;CACH;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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
|
@@ -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"}
|
|
@@ -18,6 +18,7 @@ interface Props {
|
|
|
18
18
|
contentId: string;
|
|
19
19
|
muted?: boolean;
|
|
20
20
|
autoplay?: boolean;
|
|
21
|
+
startTime?: number;
|
|
21
22
|
onPlayerEvent?: (event: {
|
|
22
23
|
nativeEvent: PlayerEventTimeUpdate | PlayerEvent | PlayerEventDurationUpdate;
|
|
23
24
|
}) => void;
|
|
@@ -34,4 +35,5 @@ declare class SpallaPlayer extends React.Component<Props> {
|
|
|
34
35
|
}
|
|
35
36
|
export declare const initialize: (token: String, applicationId: String | null) => void;
|
|
36
37
|
export default SpallaPlayer;
|
|
38
|
+
export { default as SpallaCastButton } from './components/CastButton';
|
|
37
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AActB,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,WAAW;IACnB,KAAK,EACD,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,SAAS,GACT,WAAW,GACX,SAAS,CAAC;CACf;AAED,UAAU,KAAK;IACb,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QACtB,WAAW,EACP,qBAAqB,GACrB,WAAW,GACX,yBAAyB,CAAC;KAC/B,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;IAeN,IAAI,aAGF;IAEF,KAAK,aAGH;CACH;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"}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
|
-
s.dependency "SpallaSDK", "~> 0.
|
|
19
|
+
s.dependency "SpallaSDK", "~> 0.8.0"
|
|
20
20
|
|
|
21
21
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
22
22
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
requireNativeComponent,
|
|
3
|
+
type ViewProps,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
|
|
7
|
+
export interface Props extends ViewProps {
|
|
8
|
+
style?: ViewProps['style'] & { tintColor?: string };
|
|
9
|
+
tintColor?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function CastButton({ style, ...rest }: Props) {
|
|
13
|
+
// @ts-ignore FIXME
|
|
14
|
+
return <GoogleCastButton style={[styles.default, style]} {...rest} />;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
CastButton.propTypes = {
|
|
18
|
+
/**
|
|
19
|
+
* 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.
|
|
20
|
+
*
|
|
21
|
+
* 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.
|
|
22
|
+
*/
|
|
23
|
+
// triggersDefaultCastDialog: PropTypes.bool
|
|
24
|
+
// accessibilityLabel: PropTypes.string
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const GoogleCastButton = requireNativeComponent(
|
|
28
|
+
'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
|
+
|
|
44
|
+
const styles = StyleSheet.create({
|
|
45
|
+
default: {
|
|
46
|
+
width: 40,
|
|
47
|
+
height: 40,
|
|
48
|
+
},
|
|
49
|
+
});
|
package/src/index.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
interface RNSpallaPlayerProps {
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
style?: ViewStyle;
|
|
12
|
+
startTime: number;
|
|
12
13
|
ref?: (ref: any) => void;
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -45,6 +46,7 @@ interface Props {
|
|
|
45
46
|
contentId: string;
|
|
46
47
|
muted?: boolean;
|
|
47
48
|
autoplay?: boolean;
|
|
49
|
+
startTime?: number;
|
|
48
50
|
onPlayerEvent?: (event: {
|
|
49
51
|
nativeEvent:
|
|
50
52
|
| PlayerEventTimeUpdate
|
|
@@ -78,12 +80,15 @@ class SpallaPlayer extends React.Component<Props> {
|
|
|
78
80
|
};
|
|
79
81
|
|
|
80
82
|
render() {
|
|
81
|
-
const { style } = this.props;
|
|
82
|
-
|
|
83
|
-
//const {maxHeight} = this.state;
|
|
83
|
+
const { style, startTime } = this.props;
|
|
84
84
|
|
|
85
85
|
return (
|
|
86
|
-
<RNSpallaPlayer
|
|
86
|
+
<RNSpallaPlayer
|
|
87
|
+
{...this.props}
|
|
88
|
+
ref={this._setRef}
|
|
89
|
+
style={style}
|
|
90
|
+
startTime={startTime ?? 0}
|
|
91
|
+
>
|
|
87
92
|
{this.props.children}
|
|
88
93
|
</RNSpallaPlayer>
|
|
89
94
|
);
|
|
@@ -105,3 +110,4 @@ export const initialize = (token: String, applicationId: String | null) => {
|
|
|
105
110
|
};
|
|
106
111
|
|
|
107
112
|
export default SpallaPlayer;
|
|
113
|
+
export { default as SpallaCastButton } from './components/CastButton';
|