问题
I am using media player js for my video, I am trying to play hls and dash video format in both ios and android. Here is what I have so far.
Live demo code pen: live demo
HTML
<div class="video">
<video id="player1" muted autoplay controls preload="none">
source src = "//r.dcs.redcdn.pl/hls/o2/Allegro/vod/1af1b7ee-f87b-4e55-b50f-ac9d7f3e2647/playlist.smil/playlist.m3u8"
type = "application/x-mpegURL" data - quality = "SD" >
Here is JS
$('video').mediaelementplayer({
features: ['playpause', 'current', 'progress', 'duration', 'volume', 'fullscreen', 'quality'],
stretching: "responsive",
enableAutosize: false,
startVolume: 0.5,
success: function(mediaElement, domObject) {
mediaElement.setVolume(0.5);
console.log(mediaElement);
}
});
Now when I check on a mobile device (ANDROID) I get the following error:
Media error: Format(s) not supported or source(s) not found
**
NOTE: on iPhone, everything is okay problem is with an android device
**
What do I need to do to solve this problem? any help or suggestions will be appreciated
回答1:
For future reference about this error, make sure u have the right hls files with the right codecs , here is tutorial on how to convert mp4 to hls files , the right way
https://docs.peer5.com/guides/production-ready-hls-vod/
来源:https://stackoverflow.com/questions/61751980/media-error-formats-not-supported-or-sources