Slowhand
1 month ago
327
7
Laravel

Get total (video durations) with GetID3

Posted 1 month ago by Slowhand

Dear all,

I am building a Laravel app in which I upload videos.

To recover the duration of each video, I use the following package which is very good: https://github.com/JamesHeinrich/getID3/

Where I need help is to get the total duration of all the videos and I have no idea how to handle this.

Here is an image that illustrates my research:

https://i.stack.imgur.com/XzSKP.png

public function getVideoDuration($Videofile) { $getID3 = new \getID3(); $pathVideo = 'storage/chapitres-videos/' . Auth::user()->id . '/' . $Videofile; $fileAnalyze = $getID3->analyze($pathVideo); $playtime = $fileAnalyze['playtime_string'];

    return $playtime;
}

$Videofile = $this->videoManager->videoStorage($request->file('video')); $lecture->video = $Videofile;

Thank you all and have a nice day!

Please sign in or create an account to participate in this conversation.