View mp4 and pdf using HTML5

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
wungaz
User
Posts: 214

View mp4 and pdf using HTML5

Post by wungaz »

Is it possible to view mp4 files and pdf using HTML5, i can see we can preview them when uploading


Webmaster
User
Posts: 9427

Post by Webmaster »

For mp4, simply use Custom View Tag (see Field Setup in help file) to show your field value with your HTML 5 <video> tag. (HTML 5 cannot show PDF.) Google "html5 video tag" for more info.


wungaz
User
Posts: 214

Post by wungaz »

Thank you, works perfectly


cmarafioti
User
Posts: 3

Post by cmarafioti »

could someone please explain how to do this? i don't understand the custom tag suggestion. I need to be able to view a PDF file instead of downloading it. Thank you for your help.


noorshiam
User
Posts: 67
Location: Surabaya - East Java - Indonesia
Contact:

Post by noorshiam »

Hello,

My custom view tag for view mp4 files didn't work.
This is my code for view mp4 using html5 (v2021)

<video width="120" height="160" autoplay>
  <source src="<?CurrentPage()->video_field->CurrentValue?>" type="video/mp4">
  Your browser does not support the video tag.
</video>

Any suggest will be appreciated, thank you


arbei
User
Posts: 9396

Post by arbei »

You should use <?= ... ?> to output the current value, see PHP tags.


noorshiam
User
Posts: 67
Location: Surabaya - East Java - Indonesia
Contact:

Post by noorshiam »

I try this code :

<video width="120" height="160" autoplay>
<source src="<?=urlencode(CurrentPage()->video_field->CurrentValue)?>" type="video/mp4">
Your browser does not support the video tag.
</video>

And still not working :(


arbei
User
Posts: 9396

Post by arbei »

  1. Are you sure your field variable name is "video_field"? Read Database, Table and Field Variable Names.
  2. If your field value only contains the file name, you need to add the correct path to the src attribute.

noorshiam
User
Posts: 67
Location: Surabaya - East Java - Indonesia
Contact:

Post by noorshiam »

  1. Yes, I'm sure that my variable name is "video_field"
  2. I add the path to the src attribute like this : <source src="https://mydomain.net/project1/files/"<?= urldecode(CurrentPage()->video_field->CurrentValue) ?> type="video/mp4">

Still nothing happens


arbei
User
Posts: 9396

Post by arbei »


Post Reply