refactor(android): migrate ReactExoplayerConfig to Kotlin (#3994)
* Rename .java to .kt * refactor(android): migrate ReactExoplayerConfig to Kotlin
This commit is contained in:
parent
4e7c64e707
commit
df9ffde5fa
@ -8,19 +8,14 @@ import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy
|
||||
class DefaultReactExoplayerConfig(context: Context) : ReactExoplayerConfig {
|
||||
|
||||
private var bandWidthMeter: DefaultBandwidthMeter = DefaultBandwidthMeter.Builder(context).build()
|
||||
private var disableDisconnectError: Boolean = false
|
||||
override var disableDisconnectError: Boolean = false
|
||||
override val bandwidthMeter: DefaultBandwidthMeter
|
||||
get() = bandWidthMeter
|
||||
|
||||
override fun buildLoadErrorHandlingPolicy(minLoadRetryCount: Int): LoadErrorHandlingPolicy =
|
||||
if (disableDisconnectError) {
|
||||
ReactExoplayerLoadErrorHandlingPolicy(minLoadRetryCount)
|
||||
} else {
|
||||
DefaultLoadErrorHandlingPolicy(minLoadRetryCount)
|
||||
}
|
||||
|
||||
override fun setDisableDisconnectError(disableDisconnectError: Boolean) {
|
||||
this.disableDisconnectError = disableDisconnectError
|
||||
}
|
||||
|
||||
override fun getDisableDisconnectError(): Boolean = disableDisconnectError
|
||||
|
||||
override fun getBandwidthMeter(): DefaultBandwidthMeter = bandWidthMeter
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
package com.brentvatne.exoplayer;
|
||||
|
||||
import androidx.media3.exoplayer.upstream.DefaultBandwidthMeter;
|
||||
import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
|
||||
|
||||
/**
|
||||
* Extension points to configure the Exoplayer instance
|
||||
*/
|
||||
public interface ReactExoplayerConfig {
|
||||
LoadErrorHandlingPolicy buildLoadErrorHandlingPolicy(int minLoadRetryCount);
|
||||
|
||||
void setDisableDisconnectError(boolean disableDisconnectError);
|
||||
boolean getDisableDisconnectError();
|
||||
|
||||
DefaultBandwidthMeter getBandwidthMeter();
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.brentvatne.exoplayer
|
||||
|
||||
import androidx.media3.exoplayer.upstream.DefaultBandwidthMeter
|
||||
import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy
|
||||
|
||||
interface ReactExoplayerConfig {
|
||||
fun buildLoadErrorHandlingPolicy(minLoadRetryCount: Int): LoadErrorHandlingPolicy
|
||||
var disableDisconnectError: Boolean
|
||||
val bandwidthMeter: DefaultBandwidthMeter
|
||||
}
|
Loading…
Reference in New Issue
Block a user