问题
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>
来源:https://stackoverflow.com/questions/15671868/mediaelement-js-rtmp-support-for-audio-streaming