• Welcome to PHPVIBE Forums. Please log in.
avatar_Marius P.

[ Video Sharing CMS v4 ] Add a download button for stored videos to logged in users

Started by Marius P.,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Marius P.Topic starter




Step 1: in lib/class.providers.php change :


private function getVideoId($operand, $optionaOperand = null)



to


public function getVideoId($operand, $optionaOperand = null)


Then place in tpl/main/video.php the following code:
<?php if(is_user() && $vid->VideoProvider() == "localfile") {
$vpath = $vid->getVideoId("localfile/").'@@'.get_option('mediafolder');
$download_link        = site_url() . 'stream.php?file=' . base64_encode(base64_encode($vpath));                 
?>
<a target="_blank" href="<?php echo $download_link; ?>"> Download[/url]
<?php } ?>



This will redirect the user to the hidden path file, for video it force downloads the video, for mp3 it has on click right the "Save video as" option on the generated html5 browser player.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

l1den

pHpVibe:
www.99mega.com
www.90mega.com
www.splatporn.com
  •  

Marius P.Topic starter

Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

identicalmedia

  •  

PHPVibe A.


diljigar

Hi Alex,

Can we do it easier when downloading a MP3 file, that not to rename the file from stream.php to  file.mp3 manually? instead download the file.mp3 directly OR rename it automatically.
  •  

PHPVibe A.

You can do

$vpath = get_option('mediafolder').'/'.$vid->getVideoId("localfile/");
$download_link        = site_url() .$vpath;   

identicalmedia

  •  

PHPVibe A.


identicalmedia

  •  

PHPVibe A.


reza

HI
Please re-enter the correct code? Add a download button for stored videos to everyone
I was confused what should I do?
Warm respect
  •  

reza

HI
Please re-enter the correct code? Add a download button for stored videos to everyone
I was confused what should I do?
Warm respect
  •  

PHPVibe A.

It should work, just do an

echo $download_link



or

echo '<a href="'.$download_link.'">Text for download link</a>';


Depends where you want to add it...I can't give you an ultra global solution.

You know any coding?

reza

thanks
i mean the correct code replace under code : (because when download stream.php downloaded)

<?php if(is_user() && $vid->VideoProvider() == "localfile") {
$vpath = $vid->getVideoId("localfile/").'@@'.get_option('mediafolder');
$download_link        = site_url() . 'stream.php?file=' . base64_encode(base64_encode($vpath));                 
?>


<a target="_blank" href="<?php echo $download_link; ?>"> Download[/url]




<?php } ?>
  •  

PHPVibe A.

Well, it does that to protect the link, you have to rename it to something .mp4 :)

 

Similar topics (7)

Important Announcement: PHPVibe Video Sharing CMS End of Life

Started by Marius P.


Replies: 1
Views: 36660

insite ads issue when selecting above/below video player location

Started by georgepanaitescu


Replies: 3
Views: 20065

The problem of video viewing PHPVibe 5.0

Started by Nayn


Replies: 25
Views: 67643

embed video does not work on v5

Started by neospider69


Replies: 6
Views: 47060

when slecting to unpublish music mp3 - next page says unpublished video ?

Started by spirog


Replies: 2
Views: 3879

video,playlist,images, etc. (frontend) select all deselect all reselect all

Started by spirog


Replies: 3
Views: 3479

Like a video - unlinke a video - relike a video does not work

Started by spirog


Replies: 7
Views: 3247