Chrome doesn't play the sources which only support `http` protocol - javascript

I have some audio sources that only support http protocol but I have problem with google chrome about playing them.
There is an example of my source that doesn't play in Chrome but plays in the Firefox.
What is the best solution in this situation?
<!DOCTYPE html>
<html>
<body>
<audio controls autoplay preload="none">
<source type="audio/mpeg" id="player" src="http://dl.tabamusic.com/Music/1400/01/Mohammadreza Ghaffari - Ashkam Aberoome (128).mp3">
Your browser does not support the audio element.
</audio>
</body>
</html>

Related

Video stream of H.264(avc1.640029) type won't play on Safari

Description
Here is my demo website and m3u8 source
Demo:
https://codepen.io/shaoyulan/pen/wvXQoQM
Strem source:
https://stream.huskyking.com/stream/43d1bf49-1769-41f0-ac51-88e6f35d5fc9/index.m3u8
The problem
And it's run perfectly at android or windows chrome
But got ERROR (CODE:3 MEDIA_ERR_DECODE) at safari
Both iphone and mac
Reduced test case
https://codepen.io/shaoyulan/pen/wvXQoQM
<video id="video" controls autoplay muted>
<source
type="application/x-mpegURL"
src="https://stream.huskyking.com/stream/43d1bf49-1769-41f0-ac51-88e6f35d5fc9/index.m3u8"
>
</video>
Steps to reproduce
View the page on safari
You will see the video is not playable.
What browser(s) including version(s) does this occur with?
All Sarari version
What OS(es) and version(s) does this occur with?
Safari Both on Iphone and Mac
What is expected ?
The stream is expected to playable on safari.
From research... Safari has built-in M3U8 playback on <video> tag. So at any time, you don't need and cannot use this HLS.js with it (because an important API for playing custom bytes, needed by HLS.js, is not available or not supported by the Safari browser).
Try this code in Safari (I cannot test it myself) :
<!DOCTYPE html>
<html>
<body>
<video width="640" height="400" controls>
<source
type="application/x-mpegURL"
src="https://yioushen-camera.muki001.com/stream/82a4899f-d803-4567-b7c5-221977e14646/index.m3u8" >
</video>
</body>
</html>

HTML 5 Video iOS

It may seem a dumb question but I cannot figure out a solution, I am embedding a local video using the standard html5 video syntax, the problem is that on safari / ios the video won't play and a quicktime striketrhough icon appears instead.
The same error appears on w3c page if I try to playback a video using iphone / ios (testing on xcode):
https://www.w3schools.com/html/html5_video.asp
How can I fix this problem?
This is the code I am using:
<video width="400" controls>
<source src="mov_bbb.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
Thanks.

ie10 html5 audio preload

I've been working on a musician's site with html5 audio playback. Everything works fine in Firefox and Chrome, but IE has been giving me issues, and I narrowed it down to the way I'm loading the media.
Part of my strategy to obfuscate the media source is to have an audio tag with no source, then add the source via javascript.
If I manually write the html, IE10 honors the preload="none" attribute, but if I don't include the sources and add them to the DOM via javascript, the preload attribute is ignored.
Example 1 works as intended:
<!DOCTYPE html>
<html>
<head>
<title>HTML5 audio test</title>
</head>
<body>
<p>
This is an audio tag with two source tag children of different types. Preload is set to none.
</p>
<audio id="audiotest" preload="none" controls>
<source src="test.ogg" type="audio/ogg">
<source src="test.mp3" type="audio/mpeg">
</audio>
</body>
</html>
Example 2 loads starts to download the media despite the preload attribute:
<!DOCTYPE html>
<html>
<head>
<title>HTML5 audio test</title>
</head>
<body>
<p>
This is just an audio tag with preload none with javascript adding the sources.
</p>
<audio id="audiotest" preload="none" controls>
</audio>
<script>
var oggSource = document.createElement('source');
oggSource.type='audio/ogg';
oggSource.src='test.ogg';
var mp3Source = document.createElement('source');
mp3Source.type='audio/mpeg';
mp3Source.src='test.mp3';
document.getElementById("audiotest").appendChild(oggSource);
document.getElementById("audiotest").appendChild(mp3Source);
</script>
</body>
</html>
Here are the working examples:
http://www.joshblackburn.com/test1.php
http://www.joshblackburn.com/test2.php
I was trying to figure out why none of my controls were working in IE. I figured out that it was downloading every single track and locking things up. Using the dev panel in IE10, the network trace confirms the issue.
Is this an IE bug? Do I need to figure out different ways of obfuscating my sources?
The 'real' page is www.joshblackburn.com/new.php?page=albums if anyone is interested.

What code can I use to make a video/animation/soundclip to play after a certain time on my website? Can Javascript do this in particular?

I am doing a college project whereby I have to create a website in Dreamweaver and I have to include timeline-based events on the different pages. For this I want it so when the page loads a video, for example, will play 5 seconds after followed by a sound clip.
Is there anything in Dreamweaver that will enable this? Or code in Javascript? Any help will be appreciated!
<!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>
try this as example

Html5 Audio with JavaScript won't work any browser other than chrome

Html5 Audio with JavaScript won't work any browser other than chrome
Basically on button press I want to be able to switch the current track to another. This works fine in Chrome but not in any other browser?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>MediaPlayer Won't Work in Any browser other than chrome</title>
<script type="text/javascript">
function Test(){
var Mp3Me= document.getElementById('Mp3Me');
Mp3Me.src = "http://media.rolandus.com/mp3/v-piano_vintage_piano_1.mp3";
}
</script>
</head>
<body>
<audio id="Mp3Me" autoplay autobuffer controls>
<source src="Batman.mp3" type="audio/mpeg">
</audio>
Start Piano Track
</body>
</html>
See browser audio compatibility here.
Firefox and Opera aren't able to read mp3 files. You should have the same file in Ogg or Wav to have it work on every browser.
For example the w3schools code :
<audio controls>
<source src="horse.ogg" type="audio/ogg"> <!--OGG-->
<source src="horse.mp3" type="audio/mpeg"> <!--MP3-->
Your browser does not support the audio element.
</audio>
Probably due to the browsers not being able to play MP3s. This table shows what browsers support what formats: https://developer.mozilla.org/en-US/docs/HTML/Supported_media_formats
You have to use this tag differently as in firefox you can't play MP3 files with such a code. Here is the link for your help. http://support.mozilla.org/en-US/questions/758978
Firefox doesn't support mp3. See this http://www.codingforums.com/showthread.php?t=231069
Here is another related question, Why doesn't Firefox support the MP3 file format in <audio>

Categories