I want to know is there any play to play same wmv or mp3 from javascript, that will work for all the browsers?
I had a look at HTML5 audio tag, but seems i need to add there .ogg, .mp3,.wav files to support all the browsers, though i need to have only one audio file.
Any idea?
Many Thanks,
Hrayr
If you want the best cross-browser support, you should provide more than one encoding. It's very simple to generate the other versions using a free encoding tool like Audacity. Then, provide at least an mp3 and an ogg version of the resource (I wouldn't bother with wav) as this will cover all the browsers that support html5 audio. Then, if you want to provide a fallback option, like flash, you can cover all those users of non-html5 browsers who have the flash plug-in installed. You can use something like mediaelementjs to simplify the process of providing a unified player.
There probably is a way: http://jsmad.org/.
It is a pure javascript mp3 decoder.
Related
I am using simple HTML5 <video> tag. Now chrome is playing .mkv videos but in mozilla firefox it is not supported. So, is there something which will solve my all problems related to playing video on web page?
No. If a browser doesn't support a container format or codec, then it doesn't support it and you need something installed to add support for it.
Consider offering your videos in multiple formats, or at least one with wider support.
As far as I know, the easiest solution is to transcode the video and put it in an MP4 container. Matroska has never been a container with a broad audience. If the audio and video streams are already compatible the transcoding should be pretty fast too. e.g. ffmpeg is able to do this:
$ ffmpeg -i input.mkv -codec copy output.mp4
HTML5 presents the Audio tag for embedding sounds in web pages. However, support for different formats varies. IE, Chrome and Safari will accept MP3 files, while Opera and older versions of Firefox require WAV or OGG files. I do not have access to multiple formats for each of my sound files, and at this point I am tempted to try to run file conversions on each request requiring a different format. Is there a way of playing sounds irrespective of format, preferably without using Flash?
How important is it that you support older browsers? I just tested the latest version of Opera and it plays MP3s fine. QuickTime can play MP3s as well, if they happen to have that installed. You could use that as a fallback instead of Flash. Other than that... there are apps out there to mass convert files from MP3s to other formats.
SoundManager2 seems awesome, but the main reason I'm looking to use something other than solo HTML5 is compatibility. What I would like SM2 to do is use HTML5 audio if available, and fall-back to Flash otherwise (for the same sounds). It seems like it should be able to do it, but I haven't yet figured out how.
For example, I'd create a sound called "moo" and link to the sound file. SM2 would then see if it can play that sound using HTML5. If not, it would load Flash to play the sound instead. From the perspective of my app, I should only request the playback of "moo" and SM2 would take care of making sure it plays.
I suspect it may be necessary for me to generate the audio clips in more than one format (possibly .ogg for HTML5 and MP3 for Flash?). I can do that if needed.
Alternatively, I could have my own JavaScript code to detect if the browser will be able to play sounds using HTML5 and pass a different configuration to SM2, but I'd prefer a cleaner way.
Thanks in advance :-)
yes, SM2 uses a Flash fallback:
Using HTML5 and Flash, SoundManager 2 provides reliable cross-platform
audio under a single JavaScript API
both SM2 and jPlayer will give you want you want, it just boils down to API preference.
generally, i'd choose jPlayer if cross-browser compatibility is crucial to you - SM2 is comparatively new to the world of HTML5 audio.. choose SM2 if you're happy using Flash and want more advanced features like access to the raw samples of the audio (to build a level meter or visualisation).
You should look into jPlayer.
It's what we use for cross-platform support. The documentation can be a little sparse at times, but it's rather useful.
I own a site which offers a Flash based music shopping cart which steams music using RTMP. Mobile devices are getting more and more popular and the exclusion of Flash means they don't support my Flash application. I was wondering if it's possible to create the same kind of Flash widget I have on my site in HTML5 or maybe even JavaScript alone? Is HTML5 developed enough for this kind of system? If possible, would users be able to embed an HTML5 version of our players? Can you stream music via RTMP using anything but Flash?
Thanks for your help
To answer your question YES HTML5 is documented and developed enough but the question that you should be asking is "Is HTML5 supported enough?"
HTML5 is markup AND JavaScript and its not supported in every browser. This is mitigated though by many great JavaScript libraries that will gracefully degrade depending on what browser/device is viewing it.
If you just want to learn more and make a decision for yourself I would suggest reading Dive into HTML5 to figure out what HTML5 is all about and what it offers.
No, you cannot stream music using RTMP in HTML5. However, you can offer music in mp3 and ogg formats. (You'll need to offer both to cover all browsers)
After looking at your site, I would recommend you continue to use flash because HTML5 does not support streaming audio, only audio available to download. While the shopping cart and everything else can mostly be done in HTML5, your users will still need Flash unless you want to allow users to download the music easily.
Is there a reason that all of the audio javascript libraries I'm finding (jPlayer, SoundManager 2, etc.) try to use HTML 5, and if that doesn't work attempt to use Flash but then don't fall back to anything else? Why wouldn't they try to fall back to the default HTML sound tags like <embed>, <object>, or <bgsound>?
Is there a library out there that does? I'd like to be able to play a sound if the user is using IE6 without Flash installed.
Thanks!
You can have it fallback so that if the person doesn't support HTML5 and you want to use basic HTML then just download a sound file and let the browser run an application to play it.
It isn't ideal, but as was pointed out, before HTML5 you have very few options, and since you don't like Flash your options just got reduced.