简体   繁体   中英

Show user only first few seconds of the video for unregistered users

I have a requirement to show user only first few seconds of the video for unregistered users.

I am using PHPVibe and admin is allowed to upload a large video from back-office and if user is registered to website he can view the complete video. if is not he needs to get resisted to view full length video.

I am new to PHPVibe and if there is any option available where I can achieve this or any Library I can use with this to achieve this.

You can use ffmpeg to cut the file of any length. Also it is available almost in all linux servers and also it is completely free. Sample command for the video cutting will be like this,

<?php
    exec('ffmpeg -i movie.mp4 -ss 00:00:03 -t 00:00:08 -async 1 cut.mp4');
?>

This will cut 8 seconds of video from 3rd second.

Refer this for complete documentation, https://www.ffmpeg.org/documentation.html

Upload 2 versions of the video; a few seconds long one and the full video. Show either one based on whatever rules your website has.

You do NOT want to get into dynamically modifying a video in PHP in order to cut it off.

The answers received are right. You can always work with the output file name without modifying the PHPVibe database. They use blabla.mp4, you could exchange this for guests as replace blabla.mp4 with blabla_short.mp4 (or the other way around), your choice. Use their videocron.php and lib/class.providers.php

But, depending on the player used, you can also stop the video at playtime. See how they do it with the end events and their overlay ads in the cms, file lib/class.providers.php and I think function _jads in lib/functions.php helps also. You can google the player events for your specific player, all have online documentation.

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM