react-native-tpstreams 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +427 -49
- package/Tpstreams.podspec +42 -42
- package/android/build.gradle +122 -122
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +4 -4
- package/android/src/main/AndroidManifestNew.xml +2 -2
- package/android/src/main/java/com/tpstreams/FragmentModule.kt +190 -190
- package/android/src/main/java/com/tpstreams/PlayerFragment.kt +210 -163
- package/android/src/main/java/com/tpstreams/TpStreamsPlayerView.kt +79 -79
- package/android/src/main/java/com/tpstreams/TpStreamsPlayerViewManager.kt +40 -40
- package/android/src/main/java/com/tpstreams/TpstreamsModule.kt +161 -138
- package/android/src/main/java/com/tpstreams/TpstreamsPackage.kt +16 -16
- package/android/src/main/res/layout/fragment_player.xml +28 -28
- package/android/src/main/res/xml/network_security_config.xml +7 -7
- package/ios/Tpstreams.h +6 -6
- package/ios/Tpstreams.mm +18 -18
- package/lib/commonjs/NativeTpstreams.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/NativeTpstreams.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/package.json +203 -203
- package/android/libs/extracted-aar/META-INF/com/android/build/gradle/aar-metadata.properties +0 -4
|
@@ -1,163 +1,210 @@
|
|
|
1
|
-
package com.tpstreams
|
|
2
|
-
|
|
3
|
-
import android.os.Bundle
|
|
4
|
-
import android.util.Log
|
|
5
|
-
import android.view.LayoutInflater
|
|
6
|
-
import android.view.View
|
|
7
|
-
import android.view.ViewGroup
|
|
8
|
-
import android.widget.Toast
|
|
9
|
-
import androidx.fragment.app.Fragment
|
|
10
|
-
import com.tpstream.player.TPStreamPlayerListener
|
|
11
|
-
import com.tpstream.player.TpInitParams
|
|
12
|
-
import com.tpstream.player.TpStreamPlayer
|
|
13
|
-
import com.tpstream.player.ui.InitializationListener
|
|
14
|
-
import com.tpstream.player.ui.TPStreamPlayerView
|
|
15
|
-
import com.tpstream.player.ui.TpStreamPlayerFragment
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
1
|
+
package com.tpstreams
|
|
2
|
+
|
|
3
|
+
import android.os.Bundle
|
|
4
|
+
import android.util.Log
|
|
5
|
+
import android.view.LayoutInflater
|
|
6
|
+
import android.view.View
|
|
7
|
+
import android.view.ViewGroup
|
|
8
|
+
import android.widget.Toast
|
|
9
|
+
import androidx.fragment.app.Fragment
|
|
10
|
+
import com.tpstream.player.TPStreamPlayerListener
|
|
11
|
+
import com.tpstream.player.TpInitParams
|
|
12
|
+
import com.tpstream.player.TpStreamPlayer
|
|
13
|
+
import com.tpstream.player.ui.InitializationListener
|
|
14
|
+
import com.tpstream.player.ui.TPStreamPlayerView
|
|
15
|
+
import com.tpstream.player.ui.TpStreamPlayerFragment
|
|
16
|
+
import com.tpstream.player.constants.PlaybackError
|
|
17
|
+
import com.tpstream.player.Tracks
|
|
18
|
+
import com.tpstream.player.Timeline
|
|
19
|
+
import com.tpstream.player.DeviceInfo
|
|
20
|
+
import com.tpstreams.TpstreamsModule
|
|
21
|
+
|
|
22
|
+
class PlayerFragment : Fragment() {
|
|
23
|
+
|
|
24
|
+
lateinit var player: TpStreamPlayer
|
|
25
|
+
lateinit var playerView: TPStreamPlayerView
|
|
26
|
+
lateinit var playerFragment: TpStreamPlayerFragment
|
|
27
|
+
private var videoId :String = ""
|
|
28
|
+
private var accessToken :String = ""
|
|
29
|
+
private var enableDownloadSupport :Boolean = true
|
|
30
|
+
private var setAutoPlay :Boolean = true
|
|
31
|
+
|
|
32
|
+
companion object {
|
|
33
|
+
var instance: PlayerFragment? = null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
37
|
+
super.onCreate(savedInstanceState)
|
|
38
|
+
val bundle = arguments
|
|
39
|
+
if (bundle != null) {
|
|
40
|
+
videoId = bundle.getString("VIDEO_ID") ?: ""
|
|
41
|
+
accessToken = bundle.getString("ACCESS_TOKEN") ?: ""
|
|
42
|
+
enableDownloadSupport = bundle.getBoolean("ENABLE_DOWNLOAD_SUPPORT", true)
|
|
43
|
+
setAutoPlay = bundle.getBoolean("AUTO_PLAY", true)
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override fun onCreateView(
|
|
49
|
+
inflater: LayoutInflater, container: ViewGroup?,
|
|
50
|
+
savedInstanceState: Bundle?
|
|
51
|
+
): View? {
|
|
52
|
+
return inflater.inflate(R.layout.fragment_player, container, false)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
56
|
+
super.onViewCreated(view, savedInstanceState)
|
|
57
|
+
instance = this
|
|
58
|
+
playerFragment = childFragmentManager.findFragmentById(R.id.tpstream_player_fragment) as TpStreamPlayerFragment
|
|
59
|
+
playerFragment.setOnInitializationListener(object: InitializationListener {
|
|
60
|
+
|
|
61
|
+
override fun onInitializationSuccess(player: TpStreamPlayer) {
|
|
62
|
+
this@PlayerFragment.player = player
|
|
63
|
+
playerView = playerFragment.tpStreamPlayerView
|
|
64
|
+
loadPLayer()
|
|
65
|
+
addPlayerListener()
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
fun loadPLayer() {
|
|
71
|
+
val parameters = TpInitParams.Builder()
|
|
72
|
+
.setVideoId(videoId)
|
|
73
|
+
.setAccessToken(accessToken)
|
|
74
|
+
.enableDownloadSupport(enableDownloadSupport)
|
|
75
|
+
.setAutoPlay(setAutoPlay)
|
|
76
|
+
.build()
|
|
77
|
+
requireActivity().runOnUiThread {
|
|
78
|
+
player.load(parameters)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private fun sendEvent(eventName: String, params: Any?) {
|
|
83
|
+
TpstreamsModule.sendEvent(eventName, params)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private fun addPlayerListener(){
|
|
87
|
+
player.setListener( object : TPStreamPlayerListener {
|
|
88
|
+
override fun onPlaybackStateChanged(playbackState: Int) {
|
|
89
|
+
sendEvent("onPlaybackStateChanged", playbackState)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
override fun onAccessTokenExpired(videoId: String, callback: (String) -> Unit) {
|
|
93
|
+
sendEvent("onAccessTokenExpired", videoId)
|
|
94
|
+
callback(accessToken)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
override fun onMarkerCallback(timesInSeconds: Long) {
|
|
98
|
+
requireActivity().runOnUiThread {
|
|
99
|
+
Toast.makeText(requireContext(),"Time $timesInSeconds", Toast.LENGTH_SHORT).show()
|
|
100
|
+
}
|
|
101
|
+
sendEvent("onMarkerCallback", timesInSeconds)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
override fun onDeviceInfoChanged(deviceInfo: DeviceInfo) {
|
|
105
|
+
sendEvent("onDeviceInfoChanged", deviceInfo.toString())
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
override fun onFullScreenChanged(isFullScreen: Boolean) {
|
|
109
|
+
sendEvent("onFullScreenChanged", isFullScreen)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
override fun onIsLoadingChanged(isLoading: Boolean) {
|
|
113
|
+
sendEvent("onIsLoadingChanged", isLoading)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
override fun onIsPlayingChanged(isPlaying: Boolean) {
|
|
117
|
+
sendEvent("onIsPlayingChanged", isPlaying)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
override fun onPlayerError(playbackError: PlaybackError) {
|
|
121
|
+
sendEvent("onPlayerError", playbackError.toString())
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
override fun onSeekBackIncrementChanged(incrementMs: Long) {
|
|
125
|
+
sendEvent("onSeekBackIncrementChanged", incrementMs)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
override fun onSeekForwardIncrementChanged(incrementMs: Long) {
|
|
129
|
+
sendEvent("onSeekForwardIncrementChanged", incrementMs)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
override fun onTimelineChanged(timeline: Timeline, reason: Int) {
|
|
133
|
+
sendEvent("onTimelineChanged", null)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
override fun onTracksChanged(tracks: Tracks) {
|
|
137
|
+
sendEvent("onTracksChanged", tracks.toString())
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
}
|
|
141
|
+
// Core Player Controls
|
|
142
|
+
fun play() {
|
|
143
|
+
requireActivity().runOnUiThread {
|
|
144
|
+
player.play()
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
fun pause() {
|
|
149
|
+
requireActivity().runOnUiThread {
|
|
150
|
+
player.pause()
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
fun seekTo(position: Long) {
|
|
155
|
+
requireActivity().runOnUiThread {
|
|
156
|
+
player.seekTo(position)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
fun release() {
|
|
161
|
+
requireActivity().runOnUiThread {
|
|
162
|
+
player.release()
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
fun load(params: TpInitParams) {
|
|
167
|
+
requireActivity().runOnUiThread {
|
|
168
|
+
player.load(params)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Playback & State Management
|
|
173
|
+
fun getCurrentTime(): Double = player.getCurrentTime().toDouble()
|
|
174
|
+
|
|
175
|
+
fun getDuration(): Double = player.getDuration().toDouble()
|
|
176
|
+
|
|
177
|
+
fun getBufferedTime(): Double = player.getBufferedTime().toDouble()
|
|
178
|
+
|
|
179
|
+
fun getPlaybackState(): Int = player.getPlaybackState()
|
|
180
|
+
|
|
181
|
+
fun getPlayWhenReady(): Boolean = player.getPlayWhenReady()
|
|
182
|
+
|
|
183
|
+
fun setPlayWhenReady(playWhenReady: Boolean) {
|
|
184
|
+
requireActivity().runOnUiThread {
|
|
185
|
+
player.setPlayWhenReady(playWhenReady)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
// Speed & Volume
|
|
191
|
+
fun getPlaybackSpeed(): Float = player.getPlayBackSpeed()
|
|
192
|
+
|
|
193
|
+
fun setPlaybackSpeed(speed: Float) {
|
|
194
|
+
requireActivity().runOnUiThread {
|
|
195
|
+
player.setPlaybackSpeed(speed)
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
override fun onResume() {
|
|
200
|
+
super.onResume()
|
|
201
|
+
Log.d("ReactNativeJS", "onResume: ")
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
override fun onDestroy() {
|
|
205
|
+
super.onDestroy()
|
|
206
|
+
instance = null
|
|
207
|
+
Log.d("ReactNativeJS", "onDestroy: ")
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
}
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
package com.tpstreams
|
|
2
|
-
|
|
3
|
-
import kotlinx.coroutines.*
|
|
4
|
-
import android.content.Context
|
|
5
|
-
import android.util.AttributeSet
|
|
6
|
-
import android.widget.FrameLayout
|
|
7
|
-
import androidx.fragment.app.FragmentActivity
|
|
8
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
9
|
-
import com.facebook.react.uimanager.ThemedReactContext
|
|
10
|
-
|
|
11
|
-
class TpStreamsPlayerView @JvmOverloads constructor(
|
|
12
|
-
context: Context,
|
|
13
|
-
attrs: AttributeSet? = null
|
|
14
|
-
) : FrameLayout(context, attrs), CoroutineScope {
|
|
15
|
-
|
|
16
|
-
private var videoId: String? = null
|
|
17
|
-
private var accessToken: String? = null
|
|
18
|
-
private var enableDownload: Boolean = true
|
|
19
|
-
private var autoPlay :Boolean = true
|
|
20
|
-
private var fragmentModule: FragmentModule? = null
|
|
21
|
-
|
|
22
|
-
private val job = SupervisorJob()
|
|
23
|
-
override val coroutineContext = Dispatchers.Main + job
|
|
24
|
-
private var updateJob: Job? = null
|
|
25
|
-
|
|
26
|
-
init {
|
|
27
|
-
if (context is ThemedReactContext) {
|
|
28
|
-
val reactContext = context.reactApplicationContext
|
|
29
|
-
val activity = context.currentActivity as? FragmentActivity
|
|
30
|
-
|
|
31
|
-
if (activity != null) {
|
|
32
|
-
fragmentModule = FragmentModule(reactContext)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
fun setVideoId(id: String) {
|
|
38
|
-
videoId = id
|
|
39
|
-
updateFragment()
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
fun setAccessToken(token: String) {
|
|
43
|
-
accessToken = token
|
|
44
|
-
updateFragment()
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
fun setEnableDownload(enableDownload: Boolean?) {
|
|
48
|
-
this.enableDownload = enableDownload ?: true
|
|
49
|
-
updateFragment()
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
fun setAutoPlay(autoPlay: Boolean?) {
|
|
53
|
-
this.autoPlay = autoPlay ?: true
|
|
54
|
-
updateFragment()
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
private fun updateFragment() {
|
|
58
|
-
if (!videoId.isNullOrEmpty() && !accessToken.isNullOrEmpty()) {
|
|
59
|
-
updateJob?.cancel()
|
|
60
|
-
updateJob = launch {
|
|
61
|
-
delay(50)
|
|
62
|
-
fragmentModule?.closeCustomFragment()
|
|
63
|
-
fragmentModule?.showCustomFragment(
|
|
64
|
-
videoId!!,
|
|
65
|
-
accessToken!!,
|
|
66
|
-
enableDownload,
|
|
67
|
-
autoPlay ?: true
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
override fun onDetachedFromWindow() {
|
|
74
|
-
super.onDetachedFromWindow()
|
|
75
|
-
coroutineContext.cancel()
|
|
76
|
-
fragmentModule?.closeCustomFragment()
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}
|
|
1
|
+
package com.tpstreams
|
|
2
|
+
|
|
3
|
+
import kotlinx.coroutines.*
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.util.AttributeSet
|
|
6
|
+
import android.widget.FrameLayout
|
|
7
|
+
import androidx.fragment.app.FragmentActivity
|
|
8
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
9
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
10
|
+
|
|
11
|
+
class TpStreamsPlayerView @JvmOverloads constructor(
|
|
12
|
+
context: Context,
|
|
13
|
+
attrs: AttributeSet? = null
|
|
14
|
+
) : FrameLayout(context, attrs), CoroutineScope {
|
|
15
|
+
|
|
16
|
+
private var videoId: String? = null
|
|
17
|
+
private var accessToken: String? = null
|
|
18
|
+
private var enableDownload: Boolean = true
|
|
19
|
+
private var autoPlay :Boolean = true
|
|
20
|
+
private var fragmentModule: FragmentModule? = null
|
|
21
|
+
|
|
22
|
+
private val job = SupervisorJob()
|
|
23
|
+
override val coroutineContext = Dispatchers.Main + job
|
|
24
|
+
private var updateJob: Job? = null
|
|
25
|
+
|
|
26
|
+
init {
|
|
27
|
+
if (context is ThemedReactContext) {
|
|
28
|
+
val reactContext = context.reactApplicationContext
|
|
29
|
+
val activity = context.currentActivity as? FragmentActivity
|
|
30
|
+
|
|
31
|
+
if (activity != null) {
|
|
32
|
+
fragmentModule = FragmentModule(reactContext)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
fun setVideoId(id: String) {
|
|
38
|
+
videoId = id
|
|
39
|
+
updateFragment()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
fun setAccessToken(token: String) {
|
|
43
|
+
accessToken = token
|
|
44
|
+
updateFragment()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
fun setEnableDownload(enableDownload: Boolean?) {
|
|
48
|
+
this.enableDownload = enableDownload ?: true
|
|
49
|
+
updateFragment()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
fun setAutoPlay(autoPlay: Boolean?) {
|
|
53
|
+
this.autoPlay = autoPlay ?: true
|
|
54
|
+
updateFragment()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private fun updateFragment() {
|
|
58
|
+
if (!videoId.isNullOrEmpty() && !accessToken.isNullOrEmpty()) {
|
|
59
|
+
updateJob?.cancel()
|
|
60
|
+
updateJob = launch {
|
|
61
|
+
delay(50)
|
|
62
|
+
fragmentModule?.closeCustomFragment()
|
|
63
|
+
fragmentModule?.showCustomFragment(
|
|
64
|
+
videoId!!,
|
|
65
|
+
accessToken!!,
|
|
66
|
+
enableDownload,
|
|
67
|
+
autoPlay ?: true
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
override fun onDetachedFromWindow() {
|
|
74
|
+
super.onDetachedFromWindow()
|
|
75
|
+
coroutineContext.cancel()
|
|
76
|
+
fragmentModule?.closeCustomFragment()
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
package com.tpstreams
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.uimanager.SimpleViewManager
|
|
4
|
-
import com.facebook.react.uimanager.ThemedReactContext
|
|
5
|
-
import com.facebook.react.uimanager.annotations.ReactProp
|
|
6
|
-
|
|
7
|
-
class TpStreamsPlayerViewManager : SimpleViewManager<TpStreamsPlayerView>() {
|
|
8
|
-
|
|
9
|
-
override fun getName() = "TpStreamsPlayerView"
|
|
10
|
-
|
|
11
|
-
override fun createViewInstance(reactContext : ThemedReactContext) :TpStreamsPlayerView {
|
|
12
|
-
return TpStreamsPlayerView(reactContext)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@ReactProp(name = "videoId")
|
|
16
|
-
fun setVideoId(view: TpStreamsPlayerView, videoId: String?) {
|
|
17
|
-
videoId?.let { view.setVideoId(it) }
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@ReactProp(name = "accessToken")
|
|
21
|
-
fun setAccessToken(view: TpStreamsPlayerView, accessToken: String?) {
|
|
22
|
-
accessToken?.let { view.setAccessToken(it) }
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@ReactProp(name = "enableDownload")
|
|
26
|
-
fun setEnableDownload(view: TpStreamsPlayerView, enableDownload: Boolean?) {
|
|
27
|
-
view.setEnableDownload(enableDownload)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@ReactProp(name = "autoPlay")
|
|
31
|
-
fun setAutoPlay(view: TpStreamsPlayerView, autoPlay: Boolean?) {
|
|
32
|
-
view.setAutoPlay(autoPlay)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
package com.tpstreams
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
4
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
5
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
6
|
+
|
|
7
|
+
class TpStreamsPlayerViewManager : SimpleViewManager<TpStreamsPlayerView>() {
|
|
8
|
+
|
|
9
|
+
override fun getName() = "TpStreamsPlayerView"
|
|
10
|
+
|
|
11
|
+
override fun createViewInstance(reactContext : ThemedReactContext) :TpStreamsPlayerView {
|
|
12
|
+
return TpStreamsPlayerView(reactContext)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@ReactProp(name = "videoId")
|
|
16
|
+
fun setVideoId(view: TpStreamsPlayerView, videoId: String?) {
|
|
17
|
+
videoId?.let { view.setVideoId(it) }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@ReactProp(name = "accessToken")
|
|
21
|
+
fun setAccessToken(view: TpStreamsPlayerView, accessToken: String?) {
|
|
22
|
+
accessToken?.let { view.setAccessToken(it) }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@ReactProp(name = "enableDownload")
|
|
26
|
+
fun setEnableDownload(view: TpStreamsPlayerView, enableDownload: Boolean?) {
|
|
27
|
+
view.setEnableDownload(enableDownload)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@ReactProp(name = "autoPlay")
|
|
31
|
+
fun setAutoPlay(view: TpStreamsPlayerView, autoPlay: Boolean?) {
|
|
32
|
+
view.setAutoPlay(autoPlay)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|