我得到了视频响应,但我如何在 exoplayer 中播放它这是我成功获得视频响应的代码
authenticator.authenticateWithClientCredentials(vimeoCallback(
onSuccess = {
initializePlayer()
val apiClient = VimeoApiClient(configuration, authenticator)
Log.e("DONETSK",it.data.accessToken.toString())
apiClient.fetchVideo(
uri = STAFF_PICKS_URI,
fieldFilter = null,
queryParams = null,
cacheControl = null,
callback = vimeoCallback(
onSuccess = {
// Log.e("DONETSKerere","Success")
},
onError = {
Log.e("DONETSKerere","Failed")
}
)
)
},
onError = {
}
))
这是我的撰写视图,用于显示我想要来自上述 vimeo 代码的可播放数据的 vimeo 视频如何做到这一点
@Composable
fun ExoPlaya(currentItem: Int, playbackPosition: Long, player: ExoPlayer?) {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
AndroidView(
modifier = Modifier.fillMaxSize(), // Occupy the max size in the Compose UI tree
factory = { context ->
PlayerView(context).also{
val uri = "uri"
//
val mediaItem = MediaItem.fromUri(uri)
it.player = player
it.player?.setMediaItem(mediaItem)
it.player?.playWhenReady
it.player?.seekTo(currentItem,playbackPosition)
it.player?.prepare()
it.player?.play()
}
},
update = { view ->
}
)
}
}