Cannot get mp4 file to display

7 posts by 4 authors in: Forums > CMS Builder
Last Post: February 13, 2012   (RSS)

By Mel - February 4, 2012

Hi everyone any thoughts on this problem would be appreciated

No player or clip is showing

Have in enabled the file extension mp4 in uploads

The field is called videoclip
The mp4 file is present in uploads folder
JW player is in folder called jwplayer in root directory

The first part of the code below does a check to see if checkbox video is ticked and then if so, do something


<?php if($biosRecord['video'] =='1'): ?><h3>Video clip checkbox is ticked &amp; a mp4 file has been uploaded to field videoclip.... </h3>



<?php foreach ($biosRecord['videoclip'] as $upload): ?>
<?php if ($upload['isImage']): ?>


<script type="text/javascript">
jwplayer("container").setup({
flashplayer: "jwplayer/player.swf",
file: "<?php echo $upload['urlPath'] ?>",
height: 270,
width: 480
});
</script>



<?php endif ?>
<?php endforeach ?>


<?php endif ?>




Thanks - Mel

Re: [mel] Cannot get mp4 file to display

By Jason - February 6, 2012

Hi Mel,


I think the problem here is that you're using an if statement inside your loop, looking at the isImage field. This field will be set to false on mp4 files, so the code that displays your player is very being executed.

try this:

<?php foreach ($biosRecord['videoclip'] as $upload): ?>
<?php if ($upload['isImage']): ?>


<script type="text/javascript">
jwplayer("container").setup({
flashplayer: "jwplayer/player.swf",
file: "<?php echo $upload['urlPath'] ?>",
height: 270,
width: 480
});
</script>



<?php endif ?>
<?php endforeach ?>


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Cannot get mp4 file to display

By Mel - February 6, 2012 - edited: February 6, 2012

Hi Jason,

Thanks for the reply

Tried removing the two lines as suggested but no change... still not showing player and file

Is it something to do with the php echo for the file, although I would have thought that the player would have loaded even if the file itself was not found... have you got any other thoughts on this

file: "<?php echo $upload['urlPath'] ?>",


Thanks - Mel

Re: [mel] Cannot get mp4 file to display

By Jason - February 6, 2012

Hi,

It's hard to say without being able to see the page. Would you be able to send a url that demonstrates the problem?

Thanks,
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Cannot get mp4 file to display

By Mel - February 10, 2012

Hi Jason,

Here is URL, I have stripped out some of the fields as a way of testing to see if the coding in the other fields was causing the problem and also to make less code for you to look through

The video clip is definitely uploaded in her bio record (its the longtail demo clip that comes with the player)

url: http://viewit247.com/recordtest1.php

Regards - Mel

Re: [mel] Cannot get mp4 file to display

By (Deleted User) - February 10, 2012

Hi Mel,

I checked that the file is uploaded (http://viewit247.com/cmsAdmin/uploads/video.mp4) and that the player is in the right place (http://viewit247.com/jwplayer/player.swf) which they both are.

It seems that it's just the implementation of the JW Player code.

I notice that you're targeting the div "container" but you haven;t set a div with that id (there is one with that class however).

If you set the div class='container' to id='container' that may fix the problem.

Also, check to make sure that you're using the correct relative paths in the jwplayer script (if in doubt, use complete urls and work backwards!).

Let me know if this helps,

Tom