Player UI
This commit is contained in:
@@ -72,3 +72,21 @@ data class EngineStats(
|
||||
val droppedFrames: Int = 0,
|
||||
val extra: Map<String, String> = emptyMap(),
|
||||
)
|
||||
|
||||
/** Look of text subtitles, chosen in the player's subtitle panel. */
|
||||
data class SubtitleStyle(
|
||||
val size: Size = Size.M,
|
||||
/** ARGB. */
|
||||
val color: Int = WHITE,
|
||||
val background: Background = Background.SHADOW,
|
||||
) {
|
||||
enum class Size(val scale: Float) { S(0.8f), M(1f), L(1.25f), XL(1.5f) }
|
||||
|
||||
enum class Background { NONE, SHADOW, BOX }
|
||||
|
||||
companion object {
|
||||
const val WHITE = 0xFFFFFFFF.toInt()
|
||||
const val YELLOW = 0xFFFFE066.toInt()
|
||||
const val LIGHT_BLUE = 0xFF9FD3FF.toInt()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ interface PlaybackEngine {
|
||||
/** False once the engine knows it can't seek in this source (e.g. a Matroska index media3 can't find). */
|
||||
val isSeekable: Boolean get() = true
|
||||
|
||||
/** How far the media is loaded ahead (the timeline's buffer bar), or -1 if the engine doesn't tell. */
|
||||
val bufferedPositionMs: Long get() = -1
|
||||
|
||||
/** Adds the engine's own video views (surface, subtitle overlay) into [container]. */
|
||||
fun attachVideo(container: FrameLayout)
|
||||
fun detachVideo()
|
||||
@@ -65,6 +68,15 @@ interface DolbyVisionSwitchable {
|
||||
var useDolbyVisionDecoder: Boolean
|
||||
}
|
||||
|
||||
/** Engines that draw text subtitles (SRT, VTT …) in the user's style; ASS and bitmap subtitles keep their own look. */
|
||||
interface SubtitleStyleable {
|
||||
/** Returns false if the engine can only take the style before [PlaybackEngine.load] (the session then restarts it). */
|
||||
fun setSubtitleStyle(style: SubtitleStyle): Boolean
|
||||
|
||||
/** Lifts text subtitles above the player controls while they are shown; fraction of the video height. */
|
||||
fun setSubtitleLift(fraction: Float) {}
|
||||
}
|
||||
|
||||
interface SubtitleDelayCapable {
|
||||
fun setSubtitleDelay(delayMs: Long)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user