Colton Idle
05/15/2021, 2:41 AMallan.conda
05/15/2021, 4:56 AMColton Idle
05/15/2021, 5:11 AMallan.conda
05/15/2021, 5:12 AMallan.conda
05/15/2021, 5:13 AMallan.conda
05/15/2021, 5:13 AMColton Idle
05/15/2021, 5:17 AMColton Idle
05/15/2021, 5:22 AM@Composable
fun VideoPlayer(sourceUrl: String = "<https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4>") {
val local = LocalContext.current
val exoPlayer = remember { SimpleExoPlayer.Builder(local).build() }
LaunchedEffect(sourceUrl) {
val dataSourceFactory: DataSource.Factory =
DefaultDataSourceFactory(local, Util.getUserAgent(local, local.packageName))
val source =
ProgressiveMediaSource.Factory(dataSourceFactory)
.createMediaSource(MediaItem.fromUri(Uri.parse(sourceUrl)))
exoPlayer.setMediaSource(source)
exoPlayer.prepare()
}
// Gateway to traditional Android Views
AndroidView(
factory = { context ->
PlayerView(context).apply {
player = exoPlayer
exoPlayer.playWhenReady = true
}
})
}
Colton Idle
05/15/2021, 5:23 AMuseController
it is not recognized as an api.allan.conda
05/15/2021, 5:35 AMview.resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
or just try everything that fits your case 😄allan.conda
05/15/2021, 5:35 AMnitrog42
05/15/2021, 8:33 AMColton Idle
05/15/2021, 12:49 PMview
and then set resizeMode on it.Colton Idle
05/15/2021, 12:49 PMallan.conda
05/15/2021, 12:50 PMColton Idle
05/15/2021, 12:53 PMallan.conda
05/15/2021, 12:55 PMColton Idle
05/15/2021, 12:55 PMColton Idle
05/15/2021, 12:56 PMallan.conda
05/15/2021, 12:57 PMColton Idle
05/15/2021, 12:57 PMColton Idle
05/15/2021, 1:05 PMallan.conda
05/15/2021, 1:05 PMallan.conda
05/15/2021, 1:06 PMColton Idle
05/15/2021, 1:11 PMColton Idle
05/16/2021, 3:11 AMStyledPlayerView(context).apply {
player = exoPlayer
exoPlayer.volume = 0f
exoPlayer.playWhenReady = true
resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
defaultArtwork = ColorDrawable(Color.TRANSPARENT)
background = ColorDrawable(Color.TRANSPARENT)
setBackgroundColor(Color.TRANSPARENT)
setShutterBackgroundColor(Color.TRANSPARENT)
videoSurfaceView?.setBackgroundColor(Color.TRANSPARENT)
}
any ideas?allan.conda
05/16/2021, 5:25 AMColton Idle
05/16/2021, 5:55 AMallan.conda
05/16/2021, 6:55 AMallan.conda
05/16/2021, 6:55 AMColton Idle
05/16/2021, 7:32 AMexoPlayer.addListener(
object : Player.Listener {
override fun onIsPlayingChanged(isPlaying: Boolean) {
// I have an event here that updates state of "isPlaying" but still no luck with this method
super.onIsPlayingChanged(isPlaying)
}
})
allan.conda
05/16/2021, 7:35 AMallan.conda
05/16/2021, 7:35 AMColton Idle
05/16/2021, 7:37 AMColton Idle
05/16/2021, 7:38 AMColton Idle
05/16/2021, 7:40 AMColton Idle
05/16/2021, 7:43 AMallan.conda
05/16/2021, 7:44 AM