How to Add Video Overlay in PHP Motion
PHP Motion mods offer popup styles for your videos or image files. Use the PHP Motion mod to create an overlay on the current PHP page that shows users a specified video file. You use this function to show a larger window that overlays the page, so users do not need to navigate to a new window when they want to watch your videos.
Instructions
-
-
1
Open your PHP editor and the source code file you want to use to create the popup. Scroll down to the PHP function for the overlay code.
-
2
Define the folder and video file location. Add the following code to point to the folder and video file:
define("XMOOV_PATH_FILES", "../videos/");
$filevid = htmlspecialchars($_GET["file.wmv"]);
$file = XMOOV_PATH_ROOT . XMOOV_PATH_FILES . $filevid;Replace the folder and file name with your own variables.
-
-
3
Assemble the video packets to buffer the output to the overlay window. The following code uses the PHP Motion system variables to set the default settings for the stream:
$packet_size = ((XMOOV_CONF_ALLOW_DYNAMIC_BANDWIDTH && isset($_GET[XMOOV_GET_BANDWIDTH])) ? getBandwidthLimit("size") : XMOOV_BW_PACKET_SIZE) * 1042;
-
4
Open the video and display the streaming data in the overlay. The following code displays the video to the user:
$fh = fopen($file, "rb")
print(fread($fh, $packet_size));
-
1