mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
Fixed for android and added some peformance changes for android
This commit is contained in:
@@ -9,9 +9,7 @@ class VlcPlayerModule : Module() {
|
|||||||
|
|
||||||
View(VlcPlayerView::class) {
|
View(VlcPlayerView::class) {
|
||||||
Prop("source") { view: VlcPlayerView, source: Map<String, Any> ->
|
Prop("source") { view: VlcPlayerView, source: Map<String, Any> ->
|
||||||
if (!view.hasSource) {
|
view.setSource(source)
|
||||||
view.setSource(source)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Prop("paused") { view: VlcPlayerView, paused: Boolean ->
|
Prop("paused") { view: VlcPlayerView, paused: Boolean ->
|
||||||
|
|||||||
@@ -60,6 +60,11 @@ class VlcPlayerView(context: Context, appContext: AppContext) : ExpoView(context
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun setSource(source: Map<String, Any>) {
|
fun setSource(source: Map<String, Any>) {
|
||||||
|
if (hasSource) {
|
||||||
|
mediaPlayer?.attachViews(videoLayout, null, false, false)
|
||||||
|
play()
|
||||||
|
return
|
||||||
|
}
|
||||||
val mediaOptions = source["mediaOptions"] as? Map<String, Any> ?: emptyMap()
|
val mediaOptions = source["mediaOptions"] as? Map<String, Any> ?: emptyMap()
|
||||||
val autoplay = source["autoplay"] as? Boolean ?: false
|
val autoplay = source["autoplay"] as? Boolean ?: false
|
||||||
val isNetwork = source["isNetwork"] as? Boolean ?: false
|
val isNetwork = source["isNetwork"] as? Boolean ?: false
|
||||||
@@ -260,7 +265,7 @@ class VlcPlayerView(context: Context, appContext: AppContext) : ExpoView(context
|
|||||||
|
|
||||||
val currentTimeMs = player.time.toInt()
|
val currentTimeMs = player.time.toInt()
|
||||||
val durationMs = player.media?.duration?.toInt() ?: 0
|
val durationMs = player.media?.duration?.toInt() ?: 0
|
||||||
|
println("isPlayer Attached: ${videoLayout.isAttachedToWindow}")
|
||||||
if (currentTimeMs >= 0 && currentTimeMs < durationMs) {
|
if (currentTimeMs >= 0 && currentTimeMs < durationMs) {
|
||||||
// Set subtitle URL if available
|
// Set subtitle URL if available
|
||||||
if (player.isPlaying && !isMediaReady) {
|
if (player.isPlaying && !isMediaReady) {
|
||||||
|
|||||||
Reference in New Issue
Block a user