问题
I'm facing issues with m3u8 playlists on chrome and firefox (edge works like a charm)
I'm trying to send data converted with ffmpeg the line I use for conversion is the following making the m3u8 file at same time:
ffmpeg -i .\european-anthem-2012.mp3 -c:a aac -b:a 64k -f segment -segment_time 15 -segment_time_delta 3 -segment_list_type m3u8 -segment_list playlist_aac.m3u8 outfile_aac-%03d.aac
As destination formats I've tried also mp3: -c:a mp3 -b:a 64k
and vorbis: -c:a libvorbis -b:a 64k
the m3u8 file looks like this:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:16
#EXTINF:12.004717,
outfile_aac-000.aac
#EXTINF:15.000091,
outfile_aac-001.aac
#EXTINF:15.000091,
outfile_aac-002.aac
#EXTINF:15.000091,
outfile_aac-003.aac
#EXTINF:15.000091,
outfile_aac-004.aac
#EXTINF:15.000091,
outfile_aac-005.aac
#EXTINF:15.000091,
outfile_aac-006.aac
#EXTINF:15.000091,
outfile_aac-007.aac
#EXTINF:10.495420,
outfile_aac-008.aac
#EXT-X-ENDLIST
the file I use is this: EU Anathem
The HTML I use is this:
<html>
<audio id="track2"
src="playlist_aac.m3u8"
type="audio/x-mpegurl"
>
<p>Your browser does not support the audio element</p>
</audio>
<button onclick="document.getElementById('track2').play();">Play</button>
</html>
the files (audio pieces, playlist and html) used are in the same local folder as the html page
When I run this code on edge (double clicking the HTML) everything works
on chrome as soon as I click the button the console logs audiotag.html:61 Uncaught (in promise) DOMException: The element has no supported sources
On Firefox the error is this: NotSupportedError: The media resource indicated by the src attribute or assigned media provider object was not suitable.
(Expected behavior is file playing)
来源:https://stackoverflow.com/questions/59666681/html5-audio-tag-handling-of-m3u8-in-chrome-firefox