mp3 audio works in all browsers but not IE9 - audio

I have three mp3 audio files that play fine in all browsers but play for only 1.x seconds in IE9 unless I change "controls" to "autoplay" in which case it plays just fine.
I was then sent the original, unedited file in .wav format. I encoded it myself to mp3 but have the same problem.
However, if I create my own mp3 audio file and insert it into the same markup, it works in all browsers, including IE9 with the "controls" attribute.
I can only think there is something about the settings in the original audio file that would cause the issue but don't have a clue what that could be.
Here is the test markup:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<audio src="poem.mp3" controls >
</body>
</html>
EDIT:
I put three audio files on the page. Sometimes one or two will play all the way through while the third won't play at all. Other times, two will play for a second but the third does nothing.

In case anyone is still dealing with this issue, I use the standard <audio> markup for mp3.
<audio controls="controls" preload="auto">
<source src="http://www.davehullthehullabalooer.com/help(5).mp4" type="audio/mp4"/>
<source src="http://www.davehullthehullabalooer.com/help.ogv" type="audio/ogv"/>
<source src="http://www.davehullthehullabalooer.com/help.webm" type="audio/webm"/>
<source src="http://davehullthehullabalooer.com/add-for-beatles-page-188.mp3" type="audio/mp3"/>
</audio>
In IE9: Internet options > Advanced Tab > Multimedia, I select "Play sounds in webpage"
All good!

EDIT: My fix didn't work. It still fails in IE9 but everything works still in every other browser.
An answer to my own question that solves the problem, at least, but I have not found out why.
I don't know why some mp3 files play just fine in IE9 but others, that also work well in any modern browser, won't play in IE9 using the markup I show above. I made audio play by adding the audio attribute preload="auto" and all is fine now in IE9.
Modern browsers do not need this. Why IE9 does, I do not know yet.

I was having trouble with audio controls showing on IE9 and found that IE9 struggles with the preload attribute. I didn't want the browser to preload all the files by setting them all to 'auto' but found that setting the preload setting to 'metadata' instead of 'none' did the trick. Could be an alternative solution.
http://helephant.com/2011/12/29/the-html5-audio-tag/ : "Metadata suggest that the browser just download enough of the file to find out things like dimensions, running length and size."

Ran into the same problem, audio files would only play first second when preload is set to metadata on IE9.
Turns out that my API was gzip compressing all responses and IE9 was having trouble dealing with it. After removing gzip/deflate compression from audio and video files, IE9 was fine with it.

Related

chrome offline video speed

I've being downloading videos to watch for later because my network streaming speed is shit. because of lack of good video players on windows I want to play the downloaded video in chromium. Now there exist extensions that speed up html5 streaming video's speed. but those doesnt seem to work with offline .mp4 or even offline html, I've tried this extension amongst several others and its all the same. they seem to work for websites that uses a player of some sort, but doesn't work for the example on w3school.
Why doesn't it work? Is there a work around?
Before some of you vote for irrelevance, I've already asked on meta exchange and looked on ubuntu exchange and found no solution.
Why not just use HTML5's own built-in media playback rate?
This example is modified from W3School's example on media playback rate:
(code is tested on Chrome browser only, hope it helps to solve your problem)...
<!DOCTYPE html>
<html>
<body>
<video id="vidObj" width="500" height="360" controls>
<source src="somevideofile.mp4" type="video/mp4">
</video>
<script>
var myVid = document.getElementById("vidObj");
myVid.playbackRate = 0.672; //# some testing value
//# normal speed = 1.0; half speed = 0.5; double speed= 2.0; etc...
</script>
</body>
</html>

Prevent Safari from auto-adding ',video'

Using the server-side Node code from here, but for src="data:..." I use fileSystem.readFile(). For troubleshooting/testing, can also use the video in the link on that post. It doesn't actually matter what file I use; none work.
I recently started experimenting with HTML5 video. Everything works correctly on Chrome and Firefox, but Safari has been broken for a few days and I couldn't figure out why until I took some time to look closely at the tags.
I'm using this to stream content into the page in chunks:
<video width="800" height="600" autoplay controls>
<source src="/file.mp4" type="video/mp4;base64">
Not supported.
</video>
It wasn't until I tried this:
<video width="800" height="600" autoplay controls>
<source src="data:video/mp4;base64,(Data)">
</video>
That I noticed the problem. After all, how can you go wrong when embedding the entire file?
As it turns out, Safari automatically turns the second one into this:
<video width="800" height="600" autoplay controls>
<source src="data:video/mp4,video;base64,(Data)">
</video>
I decided to drop the video from my folder into Safari to see the markup it created, and I found something curious: src was in the <video> tag instead of in its own source tag.
For kicks I changed the src tag in the video tag to match the <source> tag and the issue persisted, but instead of a blank white box, it was a black box with a Play button with a diagonal line through it. This suggests that for some reason, Safari doesn't pay attention to <source> tags, while other browsers do.
This was a more concerning issue when I discovered even if the src of the <video> is broken (By having a broken src="data:..."), it still won't check to see if there's a compatible <source>. What's really interesting is that it was paying attention to <source> a few days ago.
Since the <video>'s src had the same issue (,video), I removed the ,video by editing in the dev console and it worked exactly as it should. I attempted to put data:base64;video/mp4, but the issue persisted.
A few other things I tried included removing video/mp4;base64, from the tag entirely, which broke it on all browsers. I put video/mp4;base64 into the type parameter both in the <video> and <source> tags, and it seems those are ignored when the src is data:.
Eventually I tried an image, since those are much shorter load times, and found the same issue: Safari automatically adds ,image to embedded images.
Linked images (<img src="/file.png">) work fine with type="image/png;base64" -- and don't add ,image, while linked videos (<video src="/file.mp4">) doesn't work (And adds ,video).
I thought perhaps this could have something to do with my system not taking byte range into account yet (Per this post)... though this same video, streamed with the exact same code, worked flawlessly the first day I tried it (Call it a week ago).
To make sure I wasn't just missing something, I re-enabled the old snippet (Had a backup) just to see if it'd work that way. No dice.
Although removing ,video and ,image manually works for data: sources, it doesn't work for file sources, as even editing it manually won't cause Safari to re-request the file (When you manually edit data:, you can visibly see it reload the player).
For kicks I tried a couple other thoughts: type="video,mp4" and mp4,video, and the equivalent for src="data:...", all of which also work fine on other browsers, but fail (With an added ,video to the end) on Safari.
For a brief recap:
Video, whether src="file" or src="data:..." becomes broken by Safari's automatic addition of ,video in either src="data:..." or src="file" type="...".
Images break if src="data:..." but not if src="file".
Manual removal of ,image or ,video from a src="data:..." works.
Manual removal of ,video from a src="file" doesn't work.
Video and image both worked fine ~ a week ago with the same (And similar) code.
Video and image currently work on Chrome and Firefox.
Anyone aware of what could cause ,image and ,video to show up, and/or how to prevent it?
Not looking for an external module to work around the problem. Wondering what's causing it and how to prevent it.

JSF play video file

I want to play a video file from my web app. I use JSF. I want to know how we can open the video file with the help of any video player installed in the client's system. I know how to open a pdf file the same way. But I want to know how to open a video file.
There's no standard JSF component for this. It's however not different from as you would do in plain HTML. Just drop the video file in public webcontent (so that it's reachable by an URL) and use the HTML <embed> and/or the <object> element which points to the URL of the video file. That's basically all. Note that you can just use EL in template text. So e.g. <embed src="#{bean.videoURL}"> would work perfectly fine, as long as it generates the HTML code the way you intend (open page in browser, rightclick and View Source to see it).
The way how to create and parameterize the HTML <embed> or <object> tag in turn depends on the video format (MPEG, MOV, FLV, etc). You basically need to consult the documentation of the video format vendor for details how to use it. Since you didn't mention what format the video file is in, we can't help you further in detail. Googling the smart way should however yield sufficient examples. E.g. "embed mpeg in html".
PrimeFaces has however a <p:media> component which makes it all easier for developers who are lazy in Googling for examples and/or figuring the browser specific inconsitenties ;) It'll outright generate the right HTML code necessary for the provided video format.
See also:
How to stream audio/video files such as MP3, MP4, AVI, etc using a Servlet
This works in browsers those support HTML5.
<video controls="controls">
<source src="resources/myVideo.mp4" type="video/mp4"/>
</video>

Autoplay not working in mediaelement.js

I am trying to get mediaplayer.js to autoplay. Autoplay works perfect with the native audio tags but as soon as I implement the mediaelement java script the player works and looks great but will not autoplay anymore.
I've tried various javascript answers, none of which have worked and I have tried changing the autoplay="true" to auto or autoplay or... nothing works. I can't find anything about it on google either. There is a lot about wordpress but none of that seems to apply to non-wordpress scenarios.
The article "Autoplay MediaElementPlayer" said there was a solution but it failed to work for me.
This is my code:
<audio controls="controls" autoplay="true">
<source src="music/male.ogg" type="audio/ogg" /> <!--change song here for FF-->
<source src="music/male.m4a" type="audio/mpeg" /><!--change song here for webkit-->
</audio>
I've tried it in every browser too with no results: IE, Opera, FF, Chrome, Safari etc.
Everything works great except it will not autoplay anymore once the mediaelement javascript works. This is a simple feature of the audio tag. I've tried to implement autoplay in the provided demos and it will not work there either.
Any help would be great, thanks!
I know some might think autoplay is not good practice but my client wants it.
This works partially for me.
It's works for HTML5 but not for flash fallback.
vplayer = new MediaElementPlayer('video');
vplayer.play();

Best way to play wav files in the browser?

I have no choice but to play wav files directly in the browser (serverside encoding to mp3 isn't an option, unfortunately.)
What's the best way to do this? I'd really like to take advantage of the HTML 5 audio tag but my target audience includes many, many teens using IE6. As far as I'm aware flash isn't an option, but speedy playback really is critical.
Thanks.
Nowadays, the best way is probably just to use the HTML5 <audio> tag. In the past, you might have done it like this:
Background:
<embed src="bgsound.wav" hidden="true" autostart="true" loop="1">
On Click:
Play Sound
It's been a few years since the last answer. Embed tag was good but I had an issue trying to trigger it to play in JavaScript. New audio tag works well is most browsers.
<audio src="cat9.wav" preload></audio>
You can trigger it manually with audioElement.play()
<audio controls="controls"><source src="http://blablabla.com/hghghgh/my%20file.wav" type="audio/x-wav" /></audio>
Due to unfixed bug (issue from 2012 year?) sometimes Chromium-like browsers cannot play .wav from redirected URLs because they "think" that file size is zero. But .mp3 is OK.
Opera 12.14 and Firefox play from < audio >
tag normally in the same case (redirected URL).
I tried JPlayer's 2.9.* lib in Drupal 7 with 3 players, but not successful (was black inactive rectangle 300*14 pixels for each player).

Resources