Is there currently any support for streaming audio via RTMP using either native HTML5 or Flash fallback with MediaElement? I saw what looked like support for Video using the flashStreamer option in the video tag 'data-mejsoptions' attribute.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I know your question is a year old but I'm going to try and answer it in the hope I can save someone the time and trouble of figuring it out.
As far as I'm aware RTMP is not supported in any of the native HTML5 audio/video elements.
Luckily mediaelement.js seems to support this protocol in here Flash version
It seems this protocol is used more commonly for videos. That is why you'll have to provide a few extra arguments to make a RTMP stream work.
Here is how I got a RTMP audio stream working with mediaelement.js:
JavaScript:
$('video,audio').mediaelementplayer({
audioWidth: 500,
features: ['playpause','current', 'progress', 'volume'],
pluginVars: 'isvideo=true',
//Example rtmp://my-streaming-service.com/specific-stream
flashStreamer: "rtmp://<base-url+path>",
mode:'shim'
});
HTML:
<audio preload="none" controls="controls">
<!-- Example rtmp://my-streaming-service.com/specific-stream/64.stream -->
<source src="rtmp://<base-url+path>/<filename>" type="video/mp4">
</audio>