Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Can i get an example of the code used to mimick live tv


Have tried using this one, but its not working out

script type="text/javascript">
jwplayer("container").setup({
playlist: "http://content.jwplatform.com/feeds/DrqpQIzP.rss",
controls: "false"
});
jwplayer().onDisplayClick(function() {
jwplayer().pause();
});
jwplayer().onReady(function() {
var seconds = new Date().getMinutes()*60 + new Date().getSeconds();
var playlist = this.getPlaylist();
var offset = 0;

for (var index=0; index < playlist.length; index++) {
var duration = Math.round(playlist[index]['duration']);
if(offset + duration > seconds) {
this.playlistItem(index);
this.seek(seconds-offset);
break;
} else {
offset += duration;
}
}
});
</script>

Please, if you have any, can you give me to copy. I have a playlist with 29 videos, which i want to play between 12am and 12pm, one after the other, in TV format.

11 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

Where are you running this?

jwplatform+mqKcpNy2

User  
0 rated :

http://tv.graciousannointing.org.zw

I ahve tried using this code, but still the player is not mimicking Live tv, as the playlist starts from scratch all the time. have tried using this code

<script type="text/javascript">
jwplayer("container").setup({
playlistfile:"playlist.rss",
height:400,
width:600
});
var seconds = new Date().getMinutes()*60 + new Date().getSeconds()*60;
var offset = 0;
var list = jwplayer().getPlaylist();
for(var i=0; i<list.length; i++) {
if(offset + list[i].duration > seconds) {
jwplayer().setItem(i);
jwplayer().seek(offset);
break;
} else {
offset += list[i].duration;
}
}
</script>

Ethan Feldman

JW Player Support Agent  
0 rated :

You are loading the jw platform and the player at the same time here…

<script type="text/javascript" src="http://content.jwplatform.com/players/1R2BrKvx-5O0gi1YS.js"></script>

<script src="http://p.jwpcdn.com/6/9/jwplayer.js"></script><script type="text/javascript">

s<script type="text/javascript"> jwplayer("container").setup({ playlistfile:"playlist.rss", height:400, width:600 }); var seconds = new Date().getMinutes()*60 + new Date().getSeconds()*60; var offset = 0; var list = jwplayer().getPlaylist(); for(var i=0; i<list.length; i++) { if(offset + list[i].duration > seconds) { jwplayer().setItem(i); jwplayer().seek(offset); break; } else { offset += list[i].duration; } } </script>

The live tv script is for the player.

jwplatform+mqKcpNy2

User  
0 rated :

Yes, saw the mistake

Shoud i do this instead?

<!-----------------------------------------Starthere------------------------------------------------->

<script type="text/javascript" src="http://content.jwplatform.com/players/1R2BrKvx-5O0gi1YS.js"></script>
<script type="text/javascript">
jwplayer("container").setup({
playlistfile:""http://content.jwplatform.com/players/1R2BrKvx-5O0gi1YS.js",
});
var seconds = new Date().getMinutes()*60 + new Date().getSeconds()*60;
var offset = 0;
var list = jwplayer().getPlaylist();
for(var i=0; i<list.length; i++) {
if(offset + list[i].duration > seconds) {
jwplayer().setItem(i);
jwplayer().seek(offset);
break;
} else {
offset += list[i].duration;
}
}
</script>




<!-----------------------------------------endhere------------------------------------------------->

jwplatform+mqKcpNy2

User  
0 rated :

I removed the player, and loaded the platform. but i still cant get the player to mimick live TV

Ethan Feldman

JW Player Support Agent  
0 rated :

This code is for the player, not the platform.

jwplatform+mqKcpNy2

User  
0 rated :

Can you explain further, cause i created the playlist in the platform. And eventually i used this code here

<!-----------------------------------------Starthere------------------------------------------------->

<script type="text/javascript" src="http://content.jwplatform.com/players/1R2BrKvx-pDs1gbFe.js"></script>


<script src="http://p.jwpcdn.com/6/9/jwplayer.js"></script>
<script type="text/javascript">



$(document).ready(function(){

jwplayer().playlistItem(3);
jwplayer().onPlay(function(){

jwplayer().seek(10);
});

});



</script>


<!-----------------------------------------endhere------------------------------------------------->

But, it buffers forever!!!!!!!!!!!

jwplatform+mqKcpNy2

User  
0 rated :

Where do i get the code for the platform, cause this code i generated it from the playlist, which is in the platform right? Can you try and explain more Ethan, iv been at this for a while. Im making my answers as descriptive as possible so that you can understand my problem, but your responses are one line sentences and offering no real assistance. If this code is for the player, then at least give me pointers and direction as to how i can take this further, make the relevant changes, or what to do.

Ethan Feldman

JW Player Support Agent  
0 rated :

Here is the full code you can use for this to work.

https://gist.github.com/emaxsaun/75dfa8421881acc9deb1

You can copy and paste this onto your site and it will work just like the demo from – http://support.jwplayer.com/customer/portal/articles/1436942

jwplatform+mqKcpNy2

User  
0 rated :

Thank you

Ethan Feldman

JW Player Support Agent  
0 rated :

Np

This question has received the maximum number of answers.