Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTML5音频标签-在chrome/firefox中处理m3u8_Html_Google Chrome_Firefox_Html5 Audio_Audio Streaming - Fatal编程技术网

HTML5音频标签-在chrome/firefox中处理m3u8

HTML5音频标签-在chrome/firefox中处理m3u8,html,google-chrome,firefox,html5-audio,audio-streaming,Html,Google Chrome,Firefox,Html5 Audio,Audio Streaming,我在chrome和firefox上面临m3u8播放列表的问题(edge的工作方式很有魅力) 我正在尝试发送使用ffmpeg转换的数据。我用于转换的行如下所示,同时生成m3u8文件: 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.m3u

我在chrome和firefox上面临m3u8播放列表的问题(edge的工作方式很有魅力)

我正在尝试发送使用ffmpeg转换的数据。我用于转换的行如下所示,同时生成m3u8文件:

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
作为目标格式,我也尝试过mp3:
-c:a mp3-b:a 64k
和vorbis:
-c:a libvorbis-b:a 64k

m3u8文件如下所示:

#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
我使用的文件如下:

我使用的HTML如下所示:

<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>

您的浏览器不支持音频元素

使用的文件(音频片段、播放列表和html)与html页面位于同一本地文件夹中

当我在edge上运行此代码(双击HTML)时,一切都正常 在chrome上,只要我单击按钮,控制台就会记录
audiotag.html:61未捕获(承诺中)domeException:元素没有支持的源代码

在Firefox上,错误如下:
NotSupportedError:src属性或分配的媒体提供程序对象指示的媒体资源不合适。


(预期行为是文件播放)

这些浏览器不直接支持HLS。您需要使用类似HLS.js的东西通过MediaSource扩展加载视频。这些浏览器不直接支持HLS。您需要使用类似HLS.js的东西通过MediaSource扩展加载视频。