imanghafoori1 / laravel-video

A laravel package to stream video content.
MIT License
260 stars 41 forks source link

Add streaming events #11

Closed innoflash closed 4 years ago

innoflash commented 4 years ago

Perhaps uses have some actions to do when video start and end streaming.

Just added 2 events that they can listen to:

Users can listen to those in their project

icaroscherma commented 4 years ago

@imanghafoori1 can you merge this PR? I was going to implement this myself to manage who's watching and who's not the videos and which percentage each one has stopped. I know someone could fast-forward it to the end, but at least it's one more layer. =)

imanghafoori1 commented 4 years ago

@innoflash Could you please provide some documentation about the new feature, thank you.

icaroscherma commented 4 years ago

The newer functionalities are pretty straight-forward. There are 2 new events (VideoStreamStarted, VideoStreamEnded) that carries video information (size, path, percentage watched, etc), so now if you want to keep track of which user is watching what, you can create your own event listeners and listen to VideoStreamStarted and VideoStreamEnded, calculate how many seconds it was watched, do things like calculate the video length and the watched length to see if the user just fast-forward, if he paused to take some notes, etc.

The only thing I would commit on top of this merged PR is the removal of the line 30 of VideoStreamStarted: info('video ended');.

imanghafoori1 commented 4 years ago

Please send pull requests as I am so busy these days. Thanks ;)