Skip to content

Commit

Permalink
closes #32
Browse files Browse the repository at this point in the history
  • Loading branch information
itszechs committed Jul 9, 2022
1 parent e11568a commit 7521937
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import zechs.drive.stream.utils.util.Constants.Companion.DRIVE_API
import zechs.drive.stream.utils.util.Orientation
import zechs.drive.stream.utils.util.getNextOrientation
import zechs.drive.stream.utils.util.setOrientation
import java.util.*
import javax.inject.Inject
import kotlin.math.roundToInt

Expand Down Expand Up @@ -321,9 +322,12 @@ class PlayerActivity : AppCompatActivity() {
)
.build()

val deviceLanguage = Locale.getDefault().isO3Language
Log.d(TAG, "Device language: $deviceLanguage")

trackSelector = DefaultTrackSelector(this).apply {
parameters = this.buildUponParameters()
.setPreferredAudioLanguage("en")
.setPreferredAudioLanguage(deviceLanguage)
.build()
}

Expand Down
6 changes: 5 additions & 1 deletion mpv/src/main/java/zechs/mpv/MPVView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.SurfaceHolder
import android.view.SurfaceView
import android.view.WindowManager
import zechs.mpv.MPVLib.mpvFormat.*
import java.util.*
import kotlin.reflect.KProperty

class MPVView(
Expand Down Expand Up @@ -42,9 +43,12 @@ class MPVView(
wm.defaultDisplay
}
val refreshRate = display.mode.refreshRate
val deviceLanguage = Locale.getDefault().isO3Language

Log.v(TAG, "Display ${display.displayId} reports FPS of $refreshRate")
Log.d(TAG, "Device language: $deviceLanguage")
Log.d(TAG, "Display ${display.displayId} reports FPS of $refreshRate")

MPVLib.setOptionString("alang", deviceLanguage)
MPVLib.setOptionString("override-display-fps", refreshRate.toString())
MPVLib.setOptionString("video-sync", "audio")
MPVLib.setOptionString("vo", "gpu")
Expand Down

0 comments on commit 7521937

Please sign in to comment.