Reputation: 4941
ive this code to run live streaming using jwplayer , its 2 part one if users was using PC and other if user using iphone , setting working fine for pc but when comes to html5 auto start never works , any tips to fix my configuration for html5
PS player working on iphone just when i click play ,
<!DOCTYPE html>
<html>
<head>
<title>live stream!</title>
</head>
<body>
<br />
<br />
<br />
<br />
<br />
<center>
<script type='text/javascript' src='/player/jwplayer.js'></script>
<div id='container'></div>
<script type="text/javascript">
jwplayer('container').setup({
autostart: "true",
file: "http://184.172.184.2:8000/;listen.pls",
height: 300,
width: 600,
players: [
{ type: "flash", src: "player/player.swf", config: {provider: "sound"} },
{ type: "html5", config: {provider: "sound"} }
],
});
</script>
<br />
<br />
<br />
Please click play then wait 10 second for buffer ..... , Thanks
</center>
</body>
</html>
Upvotes: 2
Views: 5663
Reputation: 1705
From what I gathered, autostart won't work on iOS devices as media playing needs to be activated via user interaction. This leads to all kind of strange behaviour with playlists, for example -- I'm experiencing inconsistent firing of the "ended" event when playing mp3 files, tested with JWPlayer and pure HTML5 Audio objects.
Upvotes: 0
Reputation: 4357
yo can't. but you could detect the ios browser and redirect it to the video itself, causing it to start..
javascript:
function isiPhone(){
return (
(navigator.platform.indexOf("iPhone") != -1) ||
(navigator.platform.indexOf("iPod") != -1) ||
(navigator.platform.indexOf("iPad") != -1)
);
}
if(isiPhone()){
window.location = "path/to/video.mp4";
}
or php:
<?php
$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
if(
strstr($userAgent,'iphone') ||
strstr($userAgent,'ipod') ||
strstr($userAgent,'ipad')
)
{
header ("Location: path/to/video.mp4");
}
?>
Upvotes: 1
Reputation: 19723
Unfortunately, autostart does not work with iPhone's. This is what I gathered on some forums online.
Upvotes: 0