react-native-tpstreams 1.0.6 → 1.0.7-debug.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/TPStreamsRNPlayerView.podspec +1 -1
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerDelegate.java +87 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerInterface.java +34 -0
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
- package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec-generated.cpp +22 -0
- package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec.h +24 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.cpp +22 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.h +24 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.cpp +107 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h +81 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.cpp +32 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.h +34 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.cpp +17 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h +32 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.cpp +16 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.h +29 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI-generated.cpp +17 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI.h +19 -0
- package/android/src/main/java/com/tpstreams/TPStreamsRNPlayerView.kt +1 -1
- package/ios/TPStreamsRNPlayerView.swift +43 -3
- package/package.json +4 -1
|
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
|
|
|
21
21
|
'DEFINES_MODULE' => 'YES',
|
|
22
22
|
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES'
|
|
23
23
|
}
|
|
24
|
-
s.dependency "TPStreamsSDK" , "1.2.
|
|
24
|
+
s.dependency "TPStreamsSDK" , "1.2.11"
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
# Ensure the module is not built as a framework to avoid bridging header conflicts
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
15
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
16
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
17
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
18
|
+
|
|
19
|
+
public class TPStreamsRNPlayerViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & TPStreamsRNPlayerViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
20
|
+
public TPStreamsRNPlayerViewManagerDelegate(U viewManager) {
|
|
21
|
+
super(viewManager);
|
|
22
|
+
}
|
|
23
|
+
@Override
|
|
24
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
25
|
+
switch (propName) {
|
|
26
|
+
case "videoId":
|
|
27
|
+
mViewManager.setVideoId(view, value == null ? null : (String) value);
|
|
28
|
+
break;
|
|
29
|
+
case "accessToken":
|
|
30
|
+
mViewManager.setAccessToken(view, value == null ? null : (String) value);
|
|
31
|
+
break;
|
|
32
|
+
case "shouldAutoPlay":
|
|
33
|
+
mViewManager.setShouldAutoPlay(view, value == null ? false : (boolean) value);
|
|
34
|
+
break;
|
|
35
|
+
case "startAt":
|
|
36
|
+
mViewManager.setStartAt(view, value == null ? 0f : ((Double) value).doubleValue());
|
|
37
|
+
break;
|
|
38
|
+
case "enableDownload":
|
|
39
|
+
mViewManager.setEnableDownload(view, value == null ? false : (boolean) value);
|
|
40
|
+
break;
|
|
41
|
+
case "showDefaultCaptions":
|
|
42
|
+
mViewManager.setShowDefaultCaptions(view, value == null ? false : (boolean) value);
|
|
43
|
+
break;
|
|
44
|
+
case "downloadMetadata":
|
|
45
|
+
mViewManager.setDownloadMetadata(view, value == null ? null : (String) value);
|
|
46
|
+
break;
|
|
47
|
+
case "offlineLicenseExpireTime":
|
|
48
|
+
mViewManager.setOfflineLicenseExpireTime(view, value == null ? 0f : ((Double) value).doubleValue());
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
super.setProperty(view, propName, value);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@Override
|
|
56
|
+
public void receiveCommand(T view, String commandName, @Nullable ReadableArray args) {
|
|
57
|
+
switch (commandName) {
|
|
58
|
+
case "play":
|
|
59
|
+
mViewManager.play(view);
|
|
60
|
+
break;
|
|
61
|
+
case "pause":
|
|
62
|
+
mViewManager.pause(view);
|
|
63
|
+
break;
|
|
64
|
+
case "seekTo":
|
|
65
|
+
mViewManager.seekTo(view, args.getDouble(0));
|
|
66
|
+
break;
|
|
67
|
+
case "setPlaybackSpeed":
|
|
68
|
+
mViewManager.setPlaybackSpeed(view, (float) args.getDouble(0));
|
|
69
|
+
break;
|
|
70
|
+
case "getCurrentPosition":
|
|
71
|
+
mViewManager.getCurrentPosition(view);
|
|
72
|
+
break;
|
|
73
|
+
case "getDuration":
|
|
74
|
+
mViewManager.getDuration(view);
|
|
75
|
+
break;
|
|
76
|
+
case "isPlaying":
|
|
77
|
+
mViewManager.isPlaying(view);
|
|
78
|
+
break;
|
|
79
|
+
case "getPlaybackSpeed":
|
|
80
|
+
mViewManager.getPlaybackSpeed(view);
|
|
81
|
+
break;
|
|
82
|
+
case "setNewAccessToken":
|
|
83
|
+
mViewManager.setNewAccessToken(view, args.getString(0));
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
|
|
15
|
+
|
|
16
|
+
public interface TPStreamsRNPlayerViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
|
|
17
|
+
void setVideoId(T view, @Nullable String value);
|
|
18
|
+
void setAccessToken(T view, @Nullable String value);
|
|
19
|
+
void setShouldAutoPlay(T view, boolean value);
|
|
20
|
+
void setStartAt(T view, double value);
|
|
21
|
+
void setEnableDownload(T view, boolean value);
|
|
22
|
+
void setShowDefaultCaptions(T view, boolean value);
|
|
23
|
+
void setDownloadMetadata(T view, @Nullable String value);
|
|
24
|
+
void setOfflineLicenseExpireTime(T view, double value);
|
|
25
|
+
void play(T view);
|
|
26
|
+
void pause(T view);
|
|
27
|
+
void seekTo(T view, double positionMs);
|
|
28
|
+
void setPlaybackSpeed(T view, float speed);
|
|
29
|
+
void getCurrentPosition(T view);
|
|
30
|
+
void getDuration(T view);
|
|
31
|
+
void isPlaying(T view);
|
|
32
|
+
void getPlaybackSpeed(T view);
|
|
33
|
+
void setNewAccessToken(T view, String newToken);
|
|
34
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/TPStreamsPlayerViewSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_TPStreamsPlayerViewSpec
|
|
13
|
+
OBJECT
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_TPStreamsPlayerViewSpec PUBLIC . react/renderer/components/TPStreamsPlayerViewSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_TPStreamsPlayerViewSpec
|
|
21
|
+
fbjni
|
|
22
|
+
jsi
|
|
23
|
+
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
+
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
+
reactnative
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_options(
|
|
29
|
+
react_codegen_TPStreamsPlayerViewSpec
|
|
30
|
+
PRIVATE
|
|
31
|
+
-DLOG_TAG=\"ReactNative\"
|
|
32
|
+
-fexceptions
|
|
33
|
+
-frtti
|
|
34
|
+
-std=c++20
|
|
35
|
+
-Wall
|
|
36
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "TPStreamsPlayerViewSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
std::shared_ptr<TurboModule> TPStreamsPlayerViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
18
|
+
|
|
19
|
+
return nullptr;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
+
#include <ReactCommon/TurboModule.h>
|
|
15
|
+
#include <jsi/jsi.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
JSI_EXPORT
|
|
22
|
+
std::shared_ptr<TurboModule> TPStreamsPlayerViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.h>
|
|
12
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
void TPStreamsPlayerViewSpec_registerComponentDescriptorsFromCodegen(
|
|
18
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
+
registry->add(concreteComponentDescriptorProvider<TPStreamsRNPlayerViewComponentDescriptor>());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h>
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
using TPStreamsRNPlayerViewComponentDescriptor = ConcreteComponentDescriptor<TPStreamsRNPlayerViewShadowNode>;
|
|
20
|
+
|
|
21
|
+
void TPStreamsPlayerViewSpec_registerComponentDescriptorsFromCodegen(
|
|
22
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h>
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
void TPStreamsRNPlayerViewEventEmitter::onCurrentPosition(OnCurrentPosition $event) const {
|
|
17
|
+
dispatchEvent("currentPosition", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
18
|
+
auto $payload = jsi::Object(runtime);
|
|
19
|
+
$payload.setProperty(runtime, "position", $event.position);
|
|
20
|
+
return $payload;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
void TPStreamsRNPlayerViewEventEmitter::onDuration(OnDuration $event) const {
|
|
26
|
+
dispatchEvent("duration", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
27
|
+
auto $payload = jsi::Object(runtime);
|
|
28
|
+
$payload.setProperty(runtime, "duration", $event.duration);
|
|
29
|
+
return $payload;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
void TPStreamsRNPlayerViewEventEmitter::onIsPlaying(OnIsPlaying $event) const {
|
|
35
|
+
dispatchEvent("isPlaying", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
36
|
+
auto $payload = jsi::Object(runtime);
|
|
37
|
+
$payload.setProperty(runtime, "isPlaying", $event.isPlaying);
|
|
38
|
+
return $payload;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
void TPStreamsRNPlayerViewEventEmitter::onPlaybackSpeed(OnPlaybackSpeed $event) const {
|
|
44
|
+
dispatchEvent("playbackSpeed", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
45
|
+
auto $payload = jsi::Object(runtime);
|
|
46
|
+
$payload.setProperty(runtime, "speed", $event.speed);
|
|
47
|
+
return $payload;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
void TPStreamsRNPlayerViewEventEmitter::onPlayerStateChanged(OnPlayerStateChanged $event) const {
|
|
53
|
+
dispatchEvent("playerStateChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
54
|
+
auto $payload = jsi::Object(runtime);
|
|
55
|
+
$payload.setProperty(runtime, "playbackState", $event.playbackState);
|
|
56
|
+
return $payload;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
void TPStreamsRNPlayerViewEventEmitter::onIsPlayingChanged(OnIsPlayingChanged $event) const {
|
|
62
|
+
dispatchEvent("isPlayingChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
63
|
+
auto $payload = jsi::Object(runtime);
|
|
64
|
+
$payload.setProperty(runtime, "isPlaying", $event.isPlaying);
|
|
65
|
+
return $payload;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
void TPStreamsRNPlayerViewEventEmitter::onPlaybackSpeedChanged(OnPlaybackSpeedChanged $event) const {
|
|
71
|
+
dispatchEvent("playbackSpeedChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
72
|
+
auto $payload = jsi::Object(runtime);
|
|
73
|
+
$payload.setProperty(runtime, "speed", $event.speed);
|
|
74
|
+
return $payload;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
void TPStreamsRNPlayerViewEventEmitter::onIsLoadingChanged(OnIsLoadingChanged $event) const {
|
|
80
|
+
dispatchEvent("isLoadingChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
81
|
+
auto $payload = jsi::Object(runtime);
|
|
82
|
+
$payload.setProperty(runtime, "isLoading", $event.isLoading);
|
|
83
|
+
return $payload;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
void TPStreamsRNPlayerViewEventEmitter::onError(OnError $event) const {
|
|
89
|
+
dispatchEvent("error", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
90
|
+
auto $payload = jsi::Object(runtime);
|
|
91
|
+
$payload.setProperty(runtime, "message", $event.message);
|
|
92
|
+
$payload.setProperty(runtime, "code", $event.code);
|
|
93
|
+
$payload.setProperty(runtime, "details", $event.details);
|
|
94
|
+
return $payload;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
void TPStreamsRNPlayerViewEventEmitter::onAccessTokenExpired(OnAccessTokenExpired $event) const {
|
|
100
|
+
dispatchEvent("accessTokenExpired", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
101
|
+
auto $payload = jsi::Object(runtime);
|
|
102
|
+
$payload.setProperty(runtime, "videoId", $event.videoId);
|
|
103
|
+
return $payload;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
class TPStreamsRNPlayerViewEventEmitter : public ViewEventEmitter {
|
|
17
|
+
public:
|
|
18
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
19
|
+
|
|
20
|
+
struct OnCurrentPosition {
|
|
21
|
+
double position;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
struct OnDuration {
|
|
25
|
+
double duration;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
struct OnIsPlaying {
|
|
29
|
+
bool isPlaying;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
struct OnPlaybackSpeed {
|
|
33
|
+
Float speed;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
struct OnPlayerStateChanged {
|
|
37
|
+
int playbackState;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
struct OnIsPlayingChanged {
|
|
41
|
+
bool isPlaying;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
struct OnPlaybackSpeedChanged {
|
|
45
|
+
double speed;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
struct OnIsLoadingChanged {
|
|
49
|
+
bool isLoading;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
struct OnError {
|
|
53
|
+
std::string message;
|
|
54
|
+
int code;
|
|
55
|
+
std::string details;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
struct OnAccessTokenExpired {
|
|
59
|
+
std::string videoId;
|
|
60
|
+
};
|
|
61
|
+
void onCurrentPosition(OnCurrentPosition value) const;
|
|
62
|
+
|
|
63
|
+
void onDuration(OnDuration value) const;
|
|
64
|
+
|
|
65
|
+
void onIsPlaying(OnIsPlaying value) const;
|
|
66
|
+
|
|
67
|
+
void onPlaybackSpeed(OnPlaybackSpeed value) const;
|
|
68
|
+
|
|
69
|
+
void onPlayerStateChanged(OnPlayerStateChanged value) const;
|
|
70
|
+
|
|
71
|
+
void onIsPlayingChanged(OnIsPlayingChanged value) const;
|
|
72
|
+
|
|
73
|
+
void onPlaybackSpeedChanged(OnPlaybackSpeedChanged value) const;
|
|
74
|
+
|
|
75
|
+
void onIsLoadingChanged(OnIsLoadingChanged value) const;
|
|
76
|
+
|
|
77
|
+
void onError(OnError value) const;
|
|
78
|
+
|
|
79
|
+
void onAccessTokenExpired(OnAccessTokenExpired value) const;
|
|
80
|
+
};
|
|
81
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/Props.h>
|
|
12
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
13
|
+
#include <react/renderer/core/propsConversions.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
TPStreamsRNPlayerViewProps::TPStreamsRNPlayerViewProps(
|
|
18
|
+
const PropsParserContext &context,
|
|
19
|
+
const TPStreamsRNPlayerViewProps &sourceProps,
|
|
20
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
21
|
+
|
|
22
|
+
videoId(convertRawProp(context, rawProps, "videoId", sourceProps.videoId, {})),
|
|
23
|
+
accessToken(convertRawProp(context, rawProps, "accessToken", sourceProps.accessToken, {})),
|
|
24
|
+
shouldAutoPlay(convertRawProp(context, rawProps, "shouldAutoPlay", sourceProps.shouldAutoPlay, {false})),
|
|
25
|
+
startAt(convertRawProp(context, rawProps, "startAt", sourceProps.startAt, {0.0})),
|
|
26
|
+
enableDownload(convertRawProp(context, rawProps, "enableDownload", sourceProps.enableDownload, {false})),
|
|
27
|
+
showDefaultCaptions(convertRawProp(context, rawProps, "showDefaultCaptions", sourceProps.showDefaultCaptions, {false})),
|
|
28
|
+
downloadMetadata(convertRawProp(context, rawProps, "downloadMetadata", sourceProps.downloadMetadata, {})),
|
|
29
|
+
offlineLicenseExpireTime(convertRawProp(context, rawProps, "offlineLicenseExpireTime", sourceProps.offlineLicenseExpireTime, {0.0}))
|
|
30
|
+
{}
|
|
31
|
+
|
|
32
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
13
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
class TPStreamsRNPlayerViewProps final : public ViewProps {
|
|
18
|
+
public:
|
|
19
|
+
TPStreamsRNPlayerViewProps() = default;
|
|
20
|
+
TPStreamsRNPlayerViewProps(const PropsParserContext& context, const TPStreamsRNPlayerViewProps &sourceProps, const RawProps &rawProps);
|
|
21
|
+
|
|
22
|
+
#pragma mark - Props
|
|
23
|
+
|
|
24
|
+
std::string videoId{};
|
|
25
|
+
std::string accessToken{};
|
|
26
|
+
bool shouldAutoPlay{false};
|
|
27
|
+
double startAt{0.0};
|
|
28
|
+
bool enableDownload{false};
|
|
29
|
+
bool showDefaultCaptions{false};
|
|
30
|
+
std::string downloadMetadata{};
|
|
31
|
+
double offlineLicenseExpireTime{0.0};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h>
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
extern const char TPStreamsRNPlayerViewComponentName[] = "TPStreamsRNPlayerView";
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h>
|
|
14
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/Props.h>
|
|
15
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/States.h>
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <jsi/jsi.h>
|
|
18
|
+
|
|
19
|
+
namespace facebook::react {
|
|
20
|
+
|
|
21
|
+
JSI_EXPORT extern const char TPStreamsRNPlayerViewComponentName[];
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* `ShadowNode` for <TPStreamsRNPlayerView> component.
|
|
25
|
+
*/
|
|
26
|
+
using TPStreamsRNPlayerViewShadowNode = ConcreteViewShadowNode<
|
|
27
|
+
TPStreamsRNPlayerViewComponentName,
|
|
28
|
+
TPStreamsRNPlayerViewProps,
|
|
29
|
+
TPStreamsRNPlayerViewEventEmitter,
|
|
30
|
+
TPStreamsRNPlayerViewState>;
|
|
31
|
+
|
|
32
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateStateCpp.js
|
|
9
|
+
*/
|
|
10
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/States.h>
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateStateH.js
|
|
8
|
+
*/
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#ifdef ANDROID
|
|
12
|
+
#include <folly/dynamic.h>
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
class TPStreamsRNPlayerViewState {
|
|
18
|
+
public:
|
|
19
|
+
TPStreamsRNPlayerViewState() = default;
|
|
20
|
+
|
|
21
|
+
#ifdef ANDROID
|
|
22
|
+
TPStreamsRNPlayerViewState(TPStreamsRNPlayerViewState const &previousState, folly::dynamic data){};
|
|
23
|
+
folly::dynamic getDynamic() const {
|
|
24
|
+
return {};
|
|
25
|
+
};
|
|
26
|
+
#endif
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "TPStreamsPlayerViewSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
} // namespace facebook::react
|
|
@@ -140,7 +140,7 @@ class TPStreamsRNPlayerView(context: ThemedReactContext) : FrameLayout(context)
|
|
|
140
140
|
// Send initial events
|
|
141
141
|
emitEvent("onPlayerStateChanged", mapOf("playbackState" to 0))
|
|
142
142
|
emitEvent("onIsPlayingChanged", mapOf("isPlaying" to false))
|
|
143
|
-
emitEvent("onPlaybackSpeedChanged", mapOf("speed" to 1.0))
|
|
143
|
+
// emitEvent("onPlaybackSpeedChanged", mapOf("speed" to 1.0))
|
|
144
144
|
emitEvent("onIsLoadingChanged", mapOf("isLoading" to false))
|
|
145
145
|
} catch (e: Exception) {
|
|
146
146
|
Log.e("TPStreamsRN", "Error creating player", e)
|
|
@@ -6,6 +6,8 @@ import AVFoundation
|
|
|
6
6
|
|
|
7
7
|
@objc(TPStreamsRNPlayerView)
|
|
8
8
|
class TPStreamsRNPlayerView: UIView {
|
|
9
|
+
|
|
10
|
+
private static let errorCodeDRMLicenseExpired = 5100
|
|
9
11
|
|
|
10
12
|
private enum PlaybackState: Int {
|
|
11
13
|
case idle = 1
|
|
@@ -21,6 +23,7 @@ class TPStreamsRNPlayerView: UIView {
|
|
|
21
23
|
private var timeControlStatusObserver: NSKeyValueObservation?
|
|
22
24
|
private var playerStateObserver: NSKeyValueObservation?
|
|
23
25
|
private var setupScheduled = false
|
|
26
|
+
private var pendingOfflineCredentialsCompletion: ((String?, Double) -> Void)?
|
|
24
27
|
|
|
25
28
|
@objc var videoId: NSString = ""
|
|
26
29
|
@objc var accessToken: NSString = ""
|
|
@@ -142,6 +145,15 @@ class TPStreamsRNPlayerView: UIView {
|
|
|
142
145
|
|
|
143
146
|
private func configurePlayerView() {
|
|
144
147
|
guard let player = player else { return }
|
|
148
|
+
player.onRequestOfflineLicenseRenewal = { [weak self] assetId, completion in
|
|
149
|
+
guard let self = self else {
|
|
150
|
+
completion(nil, 0)
|
|
151
|
+
return
|
|
152
|
+
}
|
|
153
|
+
self.sendErrorEvent("Playback error", Self.errorCodeDRMLicenseExpired, "Offline DRM license expired")
|
|
154
|
+
self.pendingOfflineCredentialsCompletion = completion
|
|
155
|
+
self.onAccessTokenExpired?(["videoId": assetId])
|
|
156
|
+
}
|
|
145
157
|
|
|
146
158
|
let configBuilder = createPlayerConfigBuilder()
|
|
147
159
|
let playerVC = TPStreamPlayerViewController()
|
|
@@ -162,6 +174,10 @@ class TPStreamsRNPlayerView: UIView {
|
|
|
162
174
|
.setprogressBarThumbColor(.systemBlue)
|
|
163
175
|
.setwatchedProgressTrackColor(.systemBlue)
|
|
164
176
|
.setDownloadMetadata(metadataDict)
|
|
177
|
+
|
|
178
|
+
if offlineLicenseExpireTime > 0 {
|
|
179
|
+
configBuilder.setLicenseDurationSeconds(offlineLicenseExpireTime)
|
|
180
|
+
}
|
|
165
181
|
|
|
166
182
|
if enableDownload {
|
|
167
183
|
configBuilder.showDownloadOption()
|
|
@@ -184,9 +200,9 @@ class TPStreamsRNPlayerView: UIView {
|
|
|
184
200
|
|
|
185
201
|
private func observePlayerChanges() {
|
|
186
202
|
setupSeekObserver()
|
|
203
|
+
setupPlayerStateObserver()
|
|
187
204
|
setupPlaybackSpeedObserver()
|
|
188
205
|
setupPlayingStateObserver()
|
|
189
|
-
setupPlayerStateObserver()
|
|
190
206
|
}
|
|
191
207
|
|
|
192
208
|
private func setupSeekObserver() {
|
|
@@ -203,7 +219,7 @@ class TPStreamsRNPlayerView: UIView {
|
|
|
203
219
|
private func setupPlaybackSpeedObserver() {
|
|
204
220
|
guard let player = player else { return }
|
|
205
221
|
|
|
206
|
-
playbackSpeedObserver = player.observe(\.rate, options: [.new
|
|
222
|
+
playbackSpeedObserver = player.observe(\.rate, options: [.new]) { [weak self] player, _ in
|
|
207
223
|
DispatchQueue.main.async {
|
|
208
224
|
self?.onPlaybackSpeedChanged?(["speed": player.rate])
|
|
209
225
|
}
|
|
@@ -230,13 +246,31 @@ class TPStreamsRNPlayerView: UIView {
|
|
|
230
246
|
self?.onPlayerStateChanged?(["playbackState": state])
|
|
231
247
|
}
|
|
232
248
|
}
|
|
249
|
+
|
|
250
|
+
timeControlStatusObserver = player.observe(\.timeControlStatus, options: [.new, .initial]) { [weak self] player, _ in
|
|
251
|
+
DispatchQueue.main.async {
|
|
252
|
+
let state = self?.mapPlayerStateToAndroid(player.status, timeControlStatus: player.timeControlStatus) ?? PlaybackState.idle.rawValue
|
|
253
|
+
self?.onPlayerStateChanged?(["playbackState": state])
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
private func sendErrorEvent(_ message: String, _ code: Int, _ details: String) {
|
|
259
|
+
onError?([
|
|
260
|
+
"message": message,
|
|
261
|
+
"code": code,
|
|
262
|
+
"details": details
|
|
263
|
+
])
|
|
233
264
|
}
|
|
234
265
|
|
|
235
|
-
private func mapPlayerStateToAndroid(_ status: AVPlayer.Status) -> Int {
|
|
266
|
+
private func mapPlayerStateToAndroid(_ status: AVPlayer.Status, timeControlStatus: AVPlayer.TimeControlStatus? = nil) -> Int {
|
|
236
267
|
switch status {
|
|
237
268
|
case .unknown:
|
|
238
269
|
return PlaybackState.idle.rawValue
|
|
239
270
|
case .readyToPlay:
|
|
271
|
+
if timeControlStatus == .waitingToPlayAtSpecifiedRate {
|
|
272
|
+
return PlaybackState.buffering.rawValue
|
|
273
|
+
}
|
|
240
274
|
return PlaybackState.ready.rawValue
|
|
241
275
|
case .failed:
|
|
242
276
|
return PlaybackState.idle.rawValue
|
|
@@ -308,6 +342,12 @@ class TPStreamsRNPlayerView: UIView {
|
|
|
308
342
|
@objc func setNewAccessToken(_ newToken: String) {
|
|
309
343
|
pendingTokenCompletion?(newToken)
|
|
310
344
|
pendingTokenCompletion = nil
|
|
345
|
+
|
|
346
|
+
if let offlineLicenseRenewalCompletion = pendingOfflineCredentialsCompletion {
|
|
347
|
+
let duration = offlineLicenseExpireTime
|
|
348
|
+
offlineLicenseRenewalCompletion(newToken, duration)
|
|
349
|
+
pendingOfflineCredentialsCompletion = nil
|
|
350
|
+
}
|
|
311
351
|
}
|
|
312
352
|
|
|
313
353
|
override func willMove(toSuperview newSuperview: UIView?) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tpstreams",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7-debug.1",
|
|
4
4
|
"description": "Video component for TPStreams",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -166,5 +166,8 @@
|
|
|
166
166
|
"languages": "kotlin-objc",
|
|
167
167
|
"type": "fabric-view",
|
|
168
168
|
"version": "0.50.3"
|
|
169
|
+
},
|
|
170
|
+
"dependencies": {
|
|
171
|
+
"react-native-tpstreams": "^1.0.7"
|
|
169
172
|
}
|
|
170
173
|
}
|