Home > OS >  Embedded video player not showing and not playing a video file
Embedded video player not showing and not playing a video file

Time:03-26

I am developing a PHP backend to my mobile app.

There is a part where I need to show and play a hosted video file.

This is how am I trying it:

  $data[$i]['video'] = '<video controls width="500", height="300><source src="pacientes/'.$data[$i]['video'].'" type= "video/mp4; codecs="avc1.42E01E, mp4a.40.2"></video>';

Here hou have the value for $data[$i]['video'] that should be an example of the kind of video files I will find in he backend

32365bec-7ec8-4b16-a91c-58e12f68cdba1575964120438935622.mp4

And here yoy have the video file URL

enter image description here

The video is not played when clicking on the play button, and the video duration is set to 0:00.

What do I need to change to my code to show the video and let me play it?

CodePudding user response:

You must put the full video path at the source's src

<source src="full_path" > </source>

CodePudding user response:

Double check spelling, for example: some " are missing. And there is no need to add a , after attributes.

Fix:

$data[$i]['video'] = '<video controls width="500" height="300"><source src="pacientes/'.$data[$i]['video'].'" type= "video/mp4"; codecs="avc1.42E01E, mp4a.40.2"></video>';
  • Related