I have an application here where I am using jwplayer in basic jquery slider: APPLICATION
Info for basic jquery slider here: http://basic-slider.com/
Now this is what I have found out, if a slider contains multiple videos, then it displays the slider, but if a slider has one video only, it does not display video or slider.
Now what is strange is if I replace the videos for images, then it works if I have a single image as it does not display the slider but displays the image, this is fine. But my question is how to do the same thing for the video?
Here is demo for slider with images: APPLICATION
Below is code for video and slider:
$vidquery = "SELECT s.SessionId, q.QuestionId, v.VideoId, VideoFile
FROM Session s
INNER JOIN Question q ON s.SessionId = q.SessionId
INNER JOIN Video_Question vq ON q.QuestionId = vq.QuestionId
INNER JOIN Video v ON vq.VideoId = v.VideoId
WHERE s.SessionId = ?";
$vidqrystmt=$mysqli->prepare($vidquery);
// You only need to call bind_param once
$vidqrystmt->bind_param("i",$session);
// get result and assign variables (prefix with db)
$vidqrystmt->execute();
$vidqrystmt->bind_result($vidSessionId,$vidQuestionId,$vidVideoId,$vidVideoFile);
$arrVideoFile = array();
while ($vidqrystmt->fetch()) {
$arrVideoFile[ $vidQuestionId ][] = basename($vidVideoFile);
}
$vidqrystmt->close();
?>
<form action='results.php' method='post' id='exam'>
<?php
//start:procedure video
$vid_result = '';
if(empty($arrVideoFile[$key])){
$vid_result = ' ';
}else{
?>
<div id="banner-video_<?php echo $key; ?>">
<ul class="bjqs">
<?php
$i = 0;
foreach ($arrVideoFile[$key] as $v) { ?>
<li><div id="myElement-<?php echo $key.'-'.$i; ?>">Loading the player...
<script type="text/javascript">
jwplayer("myElement-<?php echo $key.'-'.$i; ?>").setup({
file: "<?php echo 'VideoFiles/'.$v; ?>",
width: 480,
height: 270
});
<?php $i++; ?>
</script>
</div>
</li>
<?php } ?>
</ul>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#banner-video_<?php echo $key; ?>').bjqs({
animtype : 'slide',
height : 300,
width : 700,
responsive : true,
randomstart : false,
automatic : false
});
});
</script>
<?php
}
//end:procedure video
?>
</div>
</form>
UPDATE:
If anyone knows how to code it so that if it is able to detect if single video, then do not place it in slider, then I believe this could solve it.
What I am saying is that by your example it looks like all your slider does it slide a image or video over and display the next or previous, but if you have only one item why not just skip all that entirely.
You have an array :
$arrVideoFileYou can use
count($arrVideoFile);to get the total values in the array.So
Let me know if this helps