Issue
I'm still new with kotlin and exoplayer. i tried to set this link as my video's source but it showed some error. Is it possible to use this kind of link? Since, i thought the problem was the unsupported format so i tried using HLS but either it didnt work or i lost some step there. Please need help
exoPlayer= ExoPlayer.Builder(this)
.setSeekBackIncrementMs(5000)
.setSeekForwardIncrementMs(5000)
.build()
playerView.player = exoPlayer
playerView.keepScreenOn = true
exoPlayer.addListener(object: Player.Listener{
override fun onPlayerStateChanged(playWhenReady: Boolean, playbackState: Int)
{
if(playbackState == Player.STATE_BUFFERING)
{
progressBar.visibility = View.VISIBLE
}
else if(playbackState == Player.STATE_READY)
{
progressBar.visibility = View.GONE
}
if(!exoPlayer.playWhenReady)
{
handler.removeCallbacks(updateProgressAction)
}
else
{
onProgress()
}
}
})
val videoSource = Uri.parse("https://vanfem.com/v/8qqlyh8lmxgkn5y")
val mediaItem = MediaItem.fromUri(videoSource)
exoPlayer.setMediaItem(mediaItem)
exoPlayer.prepare()
exoPlayer.play()
}
Solution
The link in your example is not to a video - in fact it seems to link to web ads.
ExoPlayer won't be able to play that as it's not a valid media source.
Answered By - Mick
Answer Checked By - Mary Flores (JavaFixing Volunteer)