Fixed not direct playing

This commit is contained in:
Alex Kim
2024-11-19 13:35:33 +11:00
parent f127ee2976
commit 1aed133a67
3 changed files with 13 additions and 3 deletions

View File

@@ -119,7 +119,7 @@ export default function page() {
maxStreamingBitrate: bitrateValue, maxStreamingBitrate: bitrateValue,
mediaSourceId: mediaSourceId, mediaSourceId: mediaSourceId,
subtitleStreamIndex: subtitleIndex, subtitleStreamIndex: subtitleIndex,
deviceProfile: Platform.OS === "android" ? android : native, deviceProfile: native,
}); });
if (!res) return null; if (!res) return null;

View File

@@ -148,10 +148,17 @@ class VlcPlayerView(context: Context, appContext: AppContext) : ExpoView(context
mediaPlayer?.addSlave(IMedia.Slave.Type.Subtitle, Uri.parse(subtitleURL), true) mediaPlayer?.addSlave(IMedia.Slave.Type.Subtitle, Uri.parse(subtitleURL), true)
} }
// Kotlin has its own garbage collector.
override fun onDetachedFromWindow() { override fun onDetachedFromWindow() {
println("onDetachedFromWindow") println("onDetachedFromWindow")
super.onDetachedFromWindow()
mediaPlayer?.stop()
media?.release()
mediaPlayer?.release()
libVLC?.release()
mediaPlayer = null
media = null
libVLC = null
} }
override fun onEvent(event: MediaPlayer.Event) { override fun onEvent(event: MediaPlayer.Event) {

View File

@@ -91,6 +91,9 @@ export default {
{ Format: "pgs", Method: "Embed" }, { Format: "pgs", Method: "Embed" },
{ Format: "pgs", Method: "External" }, { Format: "pgs", Method: "External" },
{ Format: "pgs", Method: "Encode" }, { Format: "pgs", Method: "Encode" },
{ Format: "pgssub", Method: "Embed" },
{ Format: "pgssub", Method: "External" },
{ Format: "pgssub", Method: "Encode" },
{ Format: "dvdsub", Method: "Embed" }, { Format: "dvdsub", Method: "Embed" },
{ Format: "dvdsub", Method: "External" }, { Format: "dvdsub", Method: "External" },
{ Format: "dvdsub", Method: "Encode" }, { Format: "dvdsub", Method: "Encode" },