I'm having a hard time trying to play some local mp3 files using Google Chrome (>57):
Playing directly in Chrome it doesn't work - the controls are grayed out;
Including an HTML5 audio element in page - same result. The code is below:
<audio controls>
<source src="[filename].mp3" type="audio/mpeg">
</audio>
My web server: Centos 6.5 running Apache 2.2
The audio files (mp3s) are just simple recordings no bigger than 5MB, 128 kbps.
The permissions of the files shouldn't be the issue (777).
Also, I added a .htaccess file that has these directives:
AddType audio/mpeg .mp3
Header set Accept-Ranges none
The same thing happens with .ogg files.
No error is thrown.
Everything works fine in Firefox, Edge, IE11.
The only way I can make it work is to serve the mp3 files (the same ones) from another location (external, another box) - so definitely is something wrong with my box. But what?
Related
I have yet to find any examples of a MP4 played using the tag for HTML5. All the examples that I have found play using alternative code for Flash or other formats. In case my test video was not suitable I downloaded from a working example online but on my web page it does not play. The code is simple enough:
<video width="640" height="360" controls autoplay>
<source src="test/big_buck_bunny.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
I have tried my test page in the latest Chrome and Firefox web browsers, but each gives the same message... "No video with supported format and MimeType found".
Chrome and Firefox do indeed support HTML5 video and the video object code is correct. So if the test page is not working the next step is to check that the server displaying the test page does indeed support MP4 files.
If you are using Apache put in your Directory directive:
AddType video/mp4 .mp4
If you are using Windows Server, instead of editing the site which can create an unwanted web.config file in your root, add the MimeType to the server. That way MP4 will be applied to all sites on the server:
Go to IIS Manager > Mime Types and add a new entry for
.mp4 video/mpeg
Click to save and then restart the server.
I have a mp4 video which is downloaded from some external site. The video is playing well in that tutorial site. But not in my site. This issue is only in ie9 browser.
source
<!DOCTYPE html>
<html>
<body>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
</body>
</html>
I have downloaded the mp4 file and also ogg file which is not important for the ie9. In the following link the video is working fine.
http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_video_all
The same source and videos only i'm using but the video is not playing.I have checked the permissions also. Please help me to resolve this problem
First load up the page and press F12 to bring up the developer tools , then pop over to the console tab in the console , get reference to the video object using the script below (If the video element is not the first video element then you will need to adjust the array value ).
document.getElementsByTagName("video")[0].error.code
The code that is returned let you know what’s gone wrong,
MEDIA_ERR_ABORTED : 1
The fetching process for the media resource was aborted by the user.
MEDIA_ERR_DECODE : 3
An error has occurred in the decoding of the media resource, after the resource was established to be usable.
MEDIA_ERR_NETWORK : 2
A network error has caused the user agent to stop fetching the media resource, after the resource was established to be usable
MEDIA_ERR_SRC_NOT_SUPPORTED : 4
The media resource specified by src was not usable.
In IE9 if you get error code 4 then there are two common issues:
INCORRECT ENCODING
IE9 supports H.264 in an MP4 container and WebM if the user has the codec installed on their machine. To support IE9 you will need to ensure that you have correctly encoded your video. For H.264 video I use Miro (a .net application on windows that wraps up FFMPEG) or if I want a specific baseline or setting I use Expression Encoder.
DIRECTORY
Are you placing the media files in the same directory holding this html?
If not, set right path to files.
MIME TYPE
You need to make sure your sever returns the correct MIME type when it returns a file. If the file is MP4 then the files MIME type should be video/mp4. If you want to check the MIME type then use the F12 developer tools (press F12 in IE9) and then navigate to the Network Tab. Press Start Capturing and refresh the web site.
GOOD LUCK
Finally i make my video work by the following way.
I found the problem by using the Jef Rechards and nmaier answers. I have faced two problems
1) My video was encoded with mpeg4 instead of h264. So i have encoded using ffmpeg libx264 codec .
2) The mime type of my video was text/plain even given the type="video/mp4" in video source. I have added the mime type by added the following code in my .htaccess file
AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm
Now the video is playing well in ie9
Ok, this is just guessing, but in order for html5 video to play, the server needs to serve the files with the correct MIME or IE9 (and other browsers) will refuse these files.
MSDN:
Beginning with Internet Explorer 9, any audio or video content needs the correct mime type set on the server, or the files won't play.
MDN:
If the MIME type for the video is not set correctly on the server, the video may not show or show a gray box containing an X (if JavaScript is enabled).
I have an HTML5 audio source defined as follows:
<audio>
<source src="../audio/segment.mp3" type="audio/mpeg" />
<source src="../audio/segment.wav" type="audio/wav" />
</audio>
The .mp3 is there for other browsers, and is expected to fail. The .wav file used to work without issue, but now does not. I have tried going over FF change logs and havent found anything in the latest releases. I am using FF 20 on Windows, and the error i receive now is:
"Media resource http://website.com/segment.wav could not be decoded"
If i throw the .wav URL in to the address bar FF will play the file without issue.
Note that at time of writing FireFox won't play 24bit .wav files. Convert them to 16 bit and they'll be happy.
I just faced this exact situation: the WAV file plays when loaded directly in Firefox, but not in an <audio> element. The problem for me was that the 44-byte header of my WAV files was invalid. After ensuring that the file length, byte rate, and block align were correct, I was able to play them just fine.
Here's the description of the WAV header specification that I used: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/.
I'm pulling my hair here trying to figure out why Safari (v6) won't play .mov files.
This is my setup, simplified -
<video width="800" height="450" controls="controls" preload="none">
<source src="example.mov" type="video/mp4" />
Your browser can't play this video.
</video>
What I'm trying to achieve is uploading movie clips to a WordPress blog from an iPhone. iPhone saves video in .mov with h264 encoding (correct?). It would be too much of a hassle for the client to render other formats as well when uploading, and we decided to settle with this format.
In Chrome, I can see this video but in Safari it won't play, even when accessing the file directly. The player simply displays its UI bar with a loading statement. I get no errors.I've also made sure to set the .htaccess file to include AddType for .mov / quicktime.What could I possibly be missing?
Could you please put this example online? Be good to examine this example.mov with ffprobe.
IOS Safari seems very sensitive how MP4s are encoded. Only thing I've found that works for me is the libx264-ipod640.ffpreset with ffmpeg. See https://github.com/kaihendry/recordmydesktop2.0 for more.
I have the following HTML5 video code on my homepage and it acts strange in Firefox 11.
<video width="900" height="508" autoplay="autoplay" controls="controls">
<source type="video/webm" src="http://www.mysite.com/MovieClip.webm"></source>
<source type="video/mp4" src="http://www.mysite.com/MovieClip.mp4"></source>
</video>
When the homepage on my site loads, I see in the place of the video the following error message:
"No video with supported format and MIME type found."
However, when I open up the media path "http://www.mysite.com/MovieClip.webm" directly, in a new tab, it loads the media just fine (using the internal Firefox HTML5 video player)!
Then, right afterwards when I go back to my homepage and refresh the page, it now loads the video just fine! Any ideas on why this is happening and how to fix?
Thanks in advance!
Be certain that your web server is configured to deliver WebM video as MIME type "video/webm". You can quickly and manually check if this is the case by telnetting to your web server and issuing a HEAD request:
telnet www.mysite.com 80
[after connection...]
HEAD /MovieClip.webm HTTP/1.1
Host: www.mysite.com
And finish the request with 2 carriage returns. The HTTP response header should contain a "Content-Type:" line. If it doesn't say "video/webm", Firefox won't accept your WebM file.
Regardng to Multimedia Mikes answer. If your server delivers the wrong mime type to the videos just put a htaccess file with following content into your videos directory:
AddType video/mp4 mp4
AddType video/ogg ogg
AddType video/webm webm
This worked out well.
If, please rate his answer ;)
Greetings
func0der
I am not entirely sure this will solve your problem, but we also have noticed erratic behavior with .webm movies in Firefox 11 (only on Windows): The video element's playhead automatically jumps to the end of the movie, even if you open the file explicitly, i.e. without a surrounding HTML page. This of course renders all autoplay settings unusable.
Our solution was to change the order of the sources, so that Firefox would prefer .ogg files over .webm - there was no need to change anything else in the HTML code.