PHP Classes

How Can You Serve Large Files with a Class for PHP Streaming Video: Serve large files to stream video

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-07-05 (3 months ago) RSS 2.0 feedStarStarStarStar 60%Total: 116 All time: 9,555 This week: 64Up
Version License PHP version Categories
streamvideo 1.0.7MIT/X Consortium ...7HTTP, Files and Folders, Video, PHP 7
Description 

Author

This package can serve large files to stream video.

It provides a class that can determine if the browser client is requesting the whole file or just a range of the file.

The class generates HTTP headers and file body data to serve only the part of the file that is being requested.

Innovation Award
PHP Programming Innovation award winner
April 2024
Winner
Nowadays video is a common form of content that many users want to consume on the Internet.

Usually, video files are large. When users want to pause watching a video they need to resume the video watching later in the position where they paused.

Streaming content helps the browsers play video instantaneously without having to wait for the video to be completely downloaded.

Nowadays video players are smart and retrieve smaller chunks of video files at any time.

This PHP utility package can serve files for streaming starting the stream download in any position upon the request of the browser or application video player.

Manuel Lemos
Picture of Ramesh Narayan Jangid
  Performance   Level  
Name: Ramesh Narayan Jangid <contact>
Classes: 9 packages by
Country: India India
Age: 48
All time rank: 3136203 in India India
Week rank: 21 Up2 in India India Up
Innovation award
Innovation award
Nominee: 4x

Winner: 3x

Instructions

In your HTML file one can have the video tag as below.

<video controls>

<source src="/Stream.php?file=/somevideo.mov">   

</video>

The server side source code may look as below.

<?php include_once ('StreamVideo.php'); $file = $_GET['file'];

$obj = new StreamVideo(); $obj->initFile($file); $obj->validateFile(); $obj->setHeaders(); $obj->streamContent();

In StreamVideo.php file one need to configure below variables as per requirement.

$videosFolderLocation $supportedMimes

  Files folder image Files (4)  
File Role Description
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Plain text file README.md Class Class source
Plain text file StreamVideo.php Class Class to stream video contents on web.

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:116
This week:0
All time:9,555
This week:64Up
User Ratings User Comments (1)
 All time
Utility:100%StarStarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:-
Examples:-
Tests:-
Videos:-
Overall:60%StarStarStarStar
Rank:1230