I am a (self-learning) beginner. I have PHP code on one page (page 1) to display a list of video files available on the server.
foreach ($filelist1 as $file2)
{
echo "<a href='???'>". $file2."</a><br>";
}
I have another page (page 2) that has the video player.
<video id="videoPlayer" width="75%" height="75%" preload controls= "controls" tabindex="0" poster="/videolibrary/2.jpg">
<source id='mp4Source' src="/videolibrary/<?php echo $usr; ?>/1.webm" type="video/mp4" />
<source id='oggSource' src="/videolibrary/<?php echo $usr; ?>/1.webm" type="video/ogg" />
<source id='webmSource' src="/videolibrary/<?php echo $usr; ?>/1.webm" type="video/webm" />
Page 1 is embedded in Page 2 as an IFRAME. My question is, when I click on the filename there on Page 1, I want the video player on Page 2 to play that video. Could you please explain how to achieve this? That would be most helpful to many beginners.
Here is this is how I would do it.
Code for page1.php:
Code for page2.php:
Requirement: For the above codes to work, create a folder named "videolibrary" in the same directory as page1.php and page2.php
Test: Open page2.php, you should get a list of video files found under the videolibrary directory in the iFrame which is displayed by page1.php. Clicking on one of them will load it in the iFrame via javascript.