Start a playlist automatically
Hi All,
I'm trying to start a playlist automatically on load with a dynamic (PHP generated Playlist). Here is my script :
<script type="text/javascript">
var playerInstance = jwplayer("myElement");
playerInstance.setup({
playlist: [
<?php
foreach ($playlist_details as $key => $video_array) {
//$video_array = $this->common_model->select_record('videos', 'id', $video_id);
//dump_exit($key);
if ($last_array_item == $video_array['id']) {
?>
{
file: '../../uploads/videos/<?php echo $video_array['video_file'];?>',
image: "",
width: "100%",
aspectratio: "16:9",
autostart: true,
title: '<?php echo addslashes($video_array['video_title']);?>',
description: '<?php echo addslashes($video_array['video_description']);?>',
mediaid: '<?php echo $video_array['id'];?>'
}
<?php
}
else {
?>
{
file: '../../uploads/videos/<?php echo $video_array['video_file'];?>',
image: "",
width: "100%",
aspectratio: "16:9",
autostart: true,
title: '<?php echo addslashes($video_array['video_title']);?>',
description: '<?php echo addslashes($video_array['video_description']);?>',
mediaid: '<?php echo $video_array['id'];?>'
},
<?php
}
}
?>
]
});
</script>
As you can see 'autostart: true' is not working in this case... Is there a way to start the videos playing on page load and then shuffle (repeat from beginning)?
Any suggestion is highly appreciated!