paly videos using php - php

i just written code for play videos
like this
$vid was the video file name where the videos are in www\videos folder.
read the content in the folder using the
<video src='videos/$vid'> it is working
same as i just try to play videos in some drive like g:\videos folder
$path='G:\videos\';
$video is video file name in that folder
here i written code like this <video src='$path\$video'
please tell me any solution for this
thank u

Your problem is that G:\videos is not a valid html path. Instead do this.
PHP
$path = 'file:///G:\videos';
$vid = 'filename.mp4';
HTML
<video src='<?="$path\$vid"?>'>

Related

pull upload issue (upload from server url) - Vimeo API Php

I am using vimeo PHP API, Here is the link of API: https://github.com/vimeo/vimeo.php
I am facing a issue when i upload video through web url.
The file is uploading but when i see the video on vimeo. It is saying:
Invalid file
There was a problem with the file you tried to upload.
I am using following line of code to send video to vimeo:
$lib = new Vimeo($config['client_id'], $config['client_secret'], $config['access_token']);
$response = $lib->request('/me/videos', ['type' => 'pull', 'link' => $videowebpath], 'POST');`
$videowebpath is weburl of mp4 file... like http://example.com/video/abx.mp4
If i upload the same file using upload function. It works fine on vimeo also.
Here is the code:
$uri = $lib->upload($absolutepath);
$absolutepath is absolute path of the mp4 file... like 'c:/example.com/video/abc.mp4'
I really want to make it work through pull uploads. Can any one let me know what could be the issue?

How to get video download link from Google Drive in PHP?

I'm trying to get the download source from a Google Drive file I own. I currently have this code:
$videoSRC = "https://www.googleapis.com/drive/v3/files/". $_GET['id']. "?alt=media&key=API_KEY_HERE";
echo '<video autoplay="" preload="auto" src="'. $videoSRC. '"></video>';
The problem is, when you look at the video source, it says the video source is "https://www.googleapis.com/drive/v3/files/GOOGLE_FILE_ID?alt=media&key=API_KEY_HERE". While it does display the video, I've seen that website have their video source as "https://redirector.googlevideo.com/videoplayback". How are they able to achieve this?
I suggest using the webContentLink of the file which is generated by using the Files.get.
Files.get uses the following URI request:
https://www.googleapis.com/drive/v3/files/fileId
Tried this on one of my file and got this webContentLink:
https://docs.google.com/uc?id=0Bzgk4zccNwI7MmJOYWs3SG1VUUE&export=download
You can pass this link in your GET request in PHP and see if it downloads the file.

Get the absolute url for BLOB image

I'm working with BLOB image in PHP. My images has no absulut url ( like this : www.example.com/my_image) . I need it because i'm woking with facebook open graph image sharing. How can i fix that?

Embed ppt file in webpage

I currently have a problem to open a .ppt/.pptx file inside a webpage. I currently have all "uploaded" file in a folder and am able to open .html/.txt files in that folder, but not .ppt/.pptx. Whenever I try, a new window pops up and Windows Uploader starts to run.
<?php
$target_dir = "C:\Apache\htdocs\upload\\";
$target_file = $_FILES['file']['name'];
?>
<iframe src = "upload/"<?php echo $target_file; ?>" name = "iframe_s" id = "download" style = "display:none"></iframe>
Click here to view files
In the above code, I try to list all files in the folder, and the goal is a user can click on one of the file, then the file will open inside the webpage. The main problem I have right now is to have the program each individually attach different .ppt url to different files.
Thank you in advance!
For your question "How to upload to Google Docs".
My first Answer:Why don't you search properly???
If you still don't find it. Then, (taken from here)
You'd use the Google Documents API to upload them using a simple HTTP POST with the data. Here's an explanation how to upload and convert documents: http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#UploadingDocs
The link will provide you will examples and all you need to do what you were asking for.
To be more precise this is what you are looking for if you want to upload pdf's: http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#ResumableUploadPUT
Python Google Documents API guide
PHP Google Documents API guide

Hide File Name in source link

I need to secure my video files from website. So, I need to decode my files name. I used the following code. But the video not playing.
<?php
$str1 = 'movie.mp4';
$enc1 = base64_encode($str1);
$str2 = 'movie.swf';
$enc2 = base64_encode($str2);
$str3 = 'movie.ogg';
$enc3 = base64_encode($str3);
$str4 = 'movie.webm';
$enc4 = base64_encode($str4);
echo "<video width='320' height='240' controls>
<source src='".$enc1."' type='video/mp4'>
<source src='".$enc3."' type='video/ogg'>
<source src='".$enc4."' type='video/webm'>
<object data='".$enc1."' width='320' height='240'>
<embed src='".$enc2."' width='320' height='240'>
</object></video> ";
?>
The reason the video is not playing is because the file you specify in src does not exist, since it is the encoded string and not the actual filename.
Trying to "hide" a filename is pointless. If you want the videos to be watchable by users, the user needs some URL where he can access the file. The URL will always by definition be public and visible to the user, otherwise it could not be used to access anything. What that URL is exactly is totally up to you. It can be the real name of the file or some random id which you somehow associate with the file on the server. It doesn't matter to the user. All that matters is that the requested data is served when the URL is accessed.
If you want to show the file only to specific users, you're looking for an authorization system, not for obfuscating the URL.
By this way file not found error will occur try to do something given below.
You can do one thing make a function which reads video file in bytes n return to player just pass the video name n path to function n play video without any url like a streaming

Categories