-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:react-native-video/react-native-v…
…ideo
- Loading branch information
Showing
12 changed files
with
194 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
android/src/main/java/com/brentvatne/common/api/BufferingStrategy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.brentvatne.common.api | ||
|
||
import com.brentvatne.common.toolbox.DebugLog | ||
|
||
/** | ||
* Define how exoplayer with load data and parsing helper | ||
*/ | ||
|
||
class BufferingStrategy { | ||
|
||
/** | ||
* Define how exoplayer with load data | ||
*/ | ||
enum class BufferingStrategyEnum { | ||
/** | ||
* default exoplayer strategy | ||
*/ | ||
Default, | ||
|
||
/** | ||
* never load more than needed | ||
*/ | ||
DisableBuffering, | ||
|
||
/** | ||
* use default strategy but pause loading when available memory is low | ||
*/ | ||
DependingOnMemory | ||
} | ||
|
||
companion object { | ||
private const val TAG = "BufferingStrategy" | ||
|
||
/** | ||
* companion function to transform input string to enum | ||
*/ | ||
fun parse(src: String?): BufferingStrategyEnum { | ||
if (src == null) return BufferingStrategyEnum.Default | ||
return try { | ||
BufferingStrategyEnum.valueOf(src) | ||
} catch (e: Exception) { | ||
DebugLog.e(TAG, "cannot parse buffering strategy " + src) | ||
BufferingStrategyEnum.Default | ||
} | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
android/src/main/java/com/brentvatne/common/api/SideLoadedTextTrack.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.brentvatne.common.api | ||
|
||
import android.net.Uri | ||
import com.brentvatne.common.toolbox.ReactBridgeUtils | ||
import com.facebook.react.bridge.ReadableMap | ||
|
||
/** | ||
* Class representing a sideLoaded text track from application | ||
* Do you use player import in this class | ||
*/ | ||
class SideLoadedTextTrack { | ||
var language: String? = null | ||
var title: String? = null | ||
var uri: Uri = Uri.EMPTY | ||
var type: String? = null | ||
companion object { | ||
val SIDELOAD_TEXT_TRACK_LANGUAGE = "language" | ||
val SIDELOAD_TEXT_TRACK_TITLE = "title" | ||
val SIDELOAD_TEXT_TRACK_URI = "uri" | ||
val SIDELOAD_TEXT_TRACK_TYPE = "type" | ||
|
||
fun parse(src: ReadableMap?): SideLoadedTextTrack { | ||
val sideLoadedTextTrack = SideLoadedTextTrack() | ||
if (src == null) { | ||
return sideLoadedTextTrack | ||
} | ||
sideLoadedTextTrack.language = ReactBridgeUtils.safeGetString(src, SIDELOAD_TEXT_TRACK_LANGUAGE) | ||
sideLoadedTextTrack.title = ReactBridgeUtils.safeGetString(src, SIDELOAD_TEXT_TRACK_TITLE, "") | ||
sideLoadedTextTrack.uri = Uri.parse(ReactBridgeUtils.safeGetString(src, SIDELOAD_TEXT_TRACK_URI, "")) | ||
sideLoadedTextTrack.type = ReactBridgeUtils.safeGetString(src, SIDELOAD_TEXT_TRACK_TYPE, "") | ||
return sideLoadedTextTrack | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
android/src/main/java/com/brentvatne/common/api/SideLoadedTextTrackList.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.brentvatne.common.api | ||
|
||
import com.facebook.react.bridge.ReadableArray | ||
import com.facebook.react.bridge.ReadableMap | ||
|
||
/** | ||
* Class representing a list of sideLoaded text track from application | ||
* Do you use player import in this class | ||
*/ | ||
|
||
class SideLoadedTextTrackList { | ||
var tracks = ArrayList<SideLoadedTextTrack>() | ||
|
||
companion object { | ||
fun parse(src: ReadableArray?): SideLoadedTextTrackList? { | ||
if (src == null) { | ||
return null | ||
} | ||
var sideLoadedTextTrackList = SideLoadedTextTrackList() | ||
for (i in 0 until src.size()) { | ||
val textTrack: ReadableMap = src.getMap(i) | ||
sideLoadedTextTrackList.tracks.add(SideLoadedTextTrack.parse(textTrack)) | ||
} | ||
return sideLoadedTextTrackList | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.