Displaying Video on page

7 posts by 4 authors in: Forums > CMS Builder
Last Post: March 22, 2018   (RSS)

By wevolutions - March 13, 2018

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.

url: http://trinicarsforsale.com/database/featured_video.php

Thank you.

Attachments:

featured_video.php 3K

By Djulia - March 14, 2018

Hi Wevolutions,

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" />
        </a>
    <?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">
        </video>
    <?php endif ?><?php break; ?>
<?php endforeach ?>

https://www.w3schools.com/html/html5_video.asp

Djulia

By wevolutions - March 14, 2018 - edited: March 14, 2018

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.

By Djulia - March 15, 2018 - edited: March 15, 2018

And this :

<?php foreach ($record['featured_video'] as $upload): ?>
  <?php if ($upload['extension'] == 'mp4'): ?>
    video == 1<br/>
    <video width="360" height="230" controls>
        <source src="<?php echo $upload['urlPath'] ?>" type="video/mp4">
    </video>
  <?php else: ?>
   video == 0
  <?php endif; ?>
<?php endforeach; ?>

By wevolutions - March 19, 2018

Thank you guys! I got it working! Much appreciated.

By Toledoh - March 22, 2018

Hey guy's.

Thought you may be interested in this also - background video that I'm using for a new site. https://foodmach.com/

<section id="video">
<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">

</video>
</section>

and SASS

#video{
display: block;
position: relative;
height: 80vh;
overflow: hidden;

margin-bottom: 2rem;

video {
position: absolute;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
transform: translate(-50%, -50%);
}

}


}

Cheers,

Tim (toledoh.com.au)