Skip to content

Commit

Permalink
fix-bug-with-mp4-video: fix mp4 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
alesiaradkevich committed Sep 19, 2023
1 parent 38351e3 commit 5e78c66
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,15 @@ class VideoPlayerController(
// In our case it will be hls
// in case of mpd/wvm formats you have to to call mediaSource.setDrmData method as well
if (videoUrl.get("videoPath") != null){
mediaSource.url = videoUrl.get("videoPath") as String
mediaSource.mediaFormat = PKMediaFormat.mp4
val url = videoUrl.get("videoPath") as String
val extension = url.substringAfterLast('.', "");
mediaSource.url = url
mediaSource.mediaFormat = if(extension=="mp4") PKMediaFormat.mp4 else PKMediaFormat.hls
} else {
mediaSource.url = videoUrl.get("videoUrl") as String
mediaSource.mediaFormat = PKMediaFormat.hls
val url = videoUrl.get("videoUrl") as String
val extension = url.substringAfterLast('.', "");
mediaSource.url = url
mediaSource.mediaFormat = if(extension=="mp4") PKMediaFormat.mp4 else PKMediaFormat.hls
}

return listOf(mediaSource)
Expand Down

0 comments on commit 5e78c66

Please sign in to comment.