Displaying Video on page
I am trying to embed a video on my page but it keeps showing as a Download link instead.
Can anyone assist me with the code please?
Attached is my current code.
This is a sample (HTML5)
<?php foreach ($record['featured_video'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $record['_link'] ?>" target="_blank">
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="360" height="230" border="0" alt="" hspace="0" vspace="5" />
<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" />
<?php else: ?>
<!-- <a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a> -->
<video width="360" height="230" controls>
<source src="<?php echo $upload['filename'] ?>" type="video/mp4">
<?php endif ?><?php break; ?>
<?php endforeach ?>
Sorry. This is not working.
If I upload the file directly on my server and put it on my html page it works.
But when I upload using the CMS Admin, it is not showing on my php page.
Here is the code that works in the html page: <embed src="Odyssey.mp4" width="730" height="320" scale="aspect" controller="false" loop="true">
Why is it not working in my php page?
Maybe I am missing some code somewhere.
The trick with cases like this is to get it working with some plain HTML code that links to the video, then view source on that and view source on viewer code and make the output identical. That's how we do it when we run into issues, we always start with getting the code working in plain HTML first. Then it's just an issue of making the viewer code that is output replicate the already working HTML code.
Let us know if you continue to have issues.
Thought you may be interested in this also - background video that I'm using for a new site. https://foodmach.com/
<video playsinline autoplay muted loop poster="static image url" id="bgvid">
<source src="insert webm video url" type="video/webm">
<source src="insert mp4 video url" type="video/mp4">
transform: translate(-50%, -50%);