Some checks failed
release / build-release (push) Has been cancelled
- IChannel: creators -> sub-channels -> video posts (public listing API, search mapped) - IRequiresMediaInfoCallback -> signed proxy URLs; stream controller rewrites HLS so the AES-128 key is fetched server-side with the session cookie, segments stay on the CDN - delivery/info cached per token lifetime and throttled (~2/min) - config page: paste sails.sid + validate, extra creators, quality, search test - scripts/package.sh -> plugin folder + zip + md5 + manifest.json; Gitea release workflow - research docs, HAR analysis (HAR itself gitignored), install-pi5.sh Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
39 lines
1.0 KiB
Kotlin
39 lines
1.0 KiB
Kotlin
package com.coulterpeterson.floatnative.data
|
|
|
|
import android.content.Context
|
|
import androidx.annotation.OptIn
|
|
import androidx.media3.common.MediaItem
|
|
import androidx.media3.common.Player
|
|
import androidx.media3.common.util.UnstableApi
|
|
import androidx.media3.exoplayer.ExoPlayer
|
|
import kotlinx.coroutines.flow.MutableStateFlow
|
|
import kotlinx.coroutines.flow.asStateFlow
|
|
|
|
@OptIn(UnstableApi::class)
|
|
class VideoPlayerManager(context: Context) {
|
|
private val _player = ExoPlayer.Builder(context).build()
|
|
val player: Player = _player
|
|
|
|
private val _isPlaying = MutableStateFlow(false)
|
|
val isPlaying = _isPlaying.asStateFlow()
|
|
|
|
init {
|
|
_player.addListener(object : Player.Listener {
|
|
override fun onIsPlayingChanged(isPlaying: Boolean) {
|
|
_isPlaying.value = isPlaying
|
|
}
|
|
})
|
|
}
|
|
|
|
fun playMedia(url: String) {
|
|
val mediaItem = MediaItem.fromUri(url)
|
|
_player.setMediaItem(mediaItem)
|
|
_player.prepare()
|
|
_player.play()
|
|
}
|
|
|
|
fun release() {
|
|
_player.release()
|
|
}
|
|
}
|