Using google drive to stream video into html5 player - google-drive-api

I tried to use google drive as a place to host videos, but whenever I try to use the video as a source, google never returns anything. (Not even a http response)
Example video player
<video>
<source
src="https://www.googleapis.com/drive/v3/files/<file_id>/?alt=media&key=<api_key>"
type="video/mp4"
/>
</video>
If I enter the url in the browser it successfully prompts me for permission to download.
Does anybody have any idea what to do?

// This works...
<video src="https://www.googleapis.com/drive/v3/files/fileID?alt=media&key=apiKey">
// But, even better if you have access to a worker or can otherwise output the file through a script (and modify resonse headers)
async function getFile(request) {
let response = await fetch('https://www.googleapis.com/drive/v3/files/fileID?alt=media&key=apiKey', request)
response = new Response(response.body, response)
response.headers.set('Accept-Ranges', 'bytes') // Allow seeking, not necessarily enabled by default
response.headers.set('Content-Disposition', 'inline') // Disable Google's attachment (download) behaviour, display directly in browser or stick into video src instead
return response
}
addEventListener('fetch', event => {
event.respondWith(getFile(event.request))
})

Short answer: Nope
Longer answer: Oh boy. I spent quite a long time trying to figure this one out myself! I'm working on a project called DriveStream, that aims to use purely JavaScript and Apps Script to make an organised video library of a Drive account.
The project itself works fine, but implementing video streaming did not go anywhere near as planned. I tried a few different methods. One similar to yours and the other involving getting the downloadUrl property of a file and parsing the html of the download prompt page to give me a direct link to the file. I can initiate a download of that file, and that can be seen in the network requests, but there is no way to get it to stream into a video container.
The reason that doesn't work is due to the limitations of AJAX. It can return the data from a video, but there seems to be no way to funnel that data into a video container.
In the end, I've had to compensate by having the 'Play' button of each video only link to the preview video.
https://drive.google.com/file/d/fileId/preview
It's not a bad workaround, as it can play up to 1080p encodes of anything you upload.

This should work:
<video>
<source src="https://drive.google.com/uc?export=download&id=file_ID" type='video/mp4'>
</video>
Replace "file_ID" in the link with your video ID. (to find it - right click on the Google Drive video, get shareable link. The file should be shared in order to access the file.)
It plays the source video. If you would like to change quality or to use unsupported codecs it's not easy to get google drive stream/converted files as said in previous answer. (Ajax will not let you get the link because of CORS and PHP is server side and the link contains an IP address so will not be accessible directly from client side.)

It's a long answer I will try to shorten it up..
Upload your file to the drive and using the share option make it public.
Then click on the preview option, and it will open a new tab.
Look for the vertical 3 dots (top right corner) leading to a sub-menu and select open in a new window.
As soon as you get to the new window click on the vertical 3 dots (top right corner) and this time you will see an 'Embed item' option click it.
You will get the iframe code now include it your webpage or website.
Just give it a try once!!!
I hope this helps thank you!!

I might be a bit late to answer, but if anyone's interested, I have written an answer on streaming videos from Google Drive before here. There are a few ways to go about this, but in summary, you will have to do some server-side programming (can be ASP.NET, PHP etc.) if you don't want to use Google Drive's embedded player. Alternatively, if you have large videos that you want to stream that exceed the limit of 100MB, have you looked into HLS (HTTP Live Streaming)? You can create .m3u8 playlists with segments of your video (preferably less than 100MB) and that way, you can stream your videos. I hope my answer helps!

Related

How to stream Large size videos from google drive in vlc

I've uploaded a large size video that is almost 2gb to my google drive. I'm streaming it in vlc media player. my format for upload is https://drive.google.com/uc?id=1wLllY5K1D6tdakUqHSQBqSQpFw4KclZ1
I'm getting through shareable link. This is small size video and it's streaming but When I upload a large size video it's not able to play.
I've changed the folder permissions to public
Due to the file-size, Google cannot automatically scan for viruses.
Thanks to this, the link you are using will show a page like this:
Even if you then add the parameters from the url of the "Download Anyways" button, you would not be able to proceed since the parameters are validated against Google servers to verify that the authorization was indeed done by the user at the time of asking.
Drive is not meant for video streaming, there are other solutions for it, like Youtube.

Is it possible to get a direct audio file link from Soundcloud without JS

I've seen many posts about using JS to embed SoundCloud tracks with API links, but I'm wondering if there is any possible way to use only the <audio> and a SoundCloud file link in HTML?
The reason I need this is because I'm using Google Sheets as a widget for my website to display a list of audio files from different sources and using other sites and getting the mp3 link and throwing it in the list for the template works well but I can't do that with SoundCloud.
Preview of widget here
I know this is the URL I need:
http://api.soundcloud.com/tracks/TRACKID/stream?client_id=CLIENTID
I've tried inspecting the web page for this information, and it's not provided. I can only get the track ID.
My google sheet's template is connected to an app called awesome-table so I can put down a long list of data without needing to manually write the HTML each time so I need to make it a uniform process.
Each cell is referred to as {{URL}} in the following example
<audio controls> <source src="{{URL}}" type="audio/mpeg"> </audio>
The additional details, such as the third-party applications, are just to explain why I'm doing it this way. The question is simply how to get the right data of a Soundcloud track in a way I can directly apply <audio controls> <source src="(soundcloud track here)" type="audio/mpeg"> </audio>
Currently, the only way to do this is if the author has enabled RSS feed for the track and by using that RSS URL in the audio source.
http://feeds.soundcloud.com/stream/example.mp3
sorry if I am kind of late, but here is the correct answer:
Go copy the song URL (not the search result, be careful!)
Now, if you have VLC Media Player downloaded, open the app.
Press CTRL+N and paste it into the box.
Hit enter.
Your song will now load.
Rightclick the song name (be sure you are in playlist view in VLC) and click information (i).
On the bottom there should be a box with the text: File location.
Rightclick the box, click select all, and CTRL+C.
Now, this is your direct mp3 link.
This is mine.
https://cf-media.sndcdn.com/gesLueRDE5tg.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vZ2VzTHVlUkRFNXRnLjEyOC5tcDMiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2MjIzMDY2Mzh9fX1dfQ__&Signature=L3tgjRJ2nnUP-9qOUBuSi9cJMQL-4aaLniOegTn2z~jnIfTrfr8oJ~JMzjiOLZHCe-sVbIaSiWt3hDEOhlf1YVLj71XF~qxV~l9LpMVtIf-V0ajRkVSBxtL8da1CVEzz4GV9~8K7twCjQhHpInHJp6tCGXU7xKb3IQ2MGVzUYX1yVhI0iBtv30ww6oDCW9MKX2qgn3dFBZ~Aw4dbLu0ba4ZnFdnto8bHZVBqqq0kY9Z5CaTmm1ikvssu37XkiFPH8b8nPI6pBfS7XvAH2M3R~pKLXIGSphlfG11VZVpXxArCcDni~WPUoQpy3S5zba6R5-KkOdM5O2FN5feJouOhAA__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ
DONT KNOW ABOUT THE LINK VALIDITY LENGHT YET!!!
Viktor

How do I get all the preview thumbnail images of a Vimeo video

I want to show all the preview thumbnail images of a Vimeo on a pages. I'm the owner of a Vimeo Pro account but I don't see any options or an API call to get them. A file with the timestamps and an image url would be good enough.
I can't run a script to generate them myself so I was wondering if anyone found such an option?
If you are talking about the preview thumbnails that appear when you seek on a video, those are not currently available via the API.
I'll make a note though, and see if we can add them in the future.

Upload video and use its URL

I have a short video that I want to upload and use in the following code:
<video>
<source src="video_url.mp4">
</video>
It's very simple but my problem is: I have no own file server. That's why I have to find a file-hosting provider where I can upload my video and use it from there.
But all they give me is just a download link for the video which is not what I need. What I need is a video-URL that directly plays the video.
For example like this one: http://clips.vorwaerts-gmbh.de/VfE_html5.mp4
I have actually found a site that does what I need. This is the site: https://pomf.se
But unfortunately, that site is not available anymore.
Can anyone help me? How or where can I upload my video to get the required link-format? (I have the same problem with audio files)
Could you use YouTube? You can create unlisted videos so they don't show up to the general public (they aren't public though). Other options could be Dropbox or S3 for inexpensive ways to host the videos yourself. Fact is, its storage space.. and that isn't free.

Embed code html to play rtmp stream with additional attributes?

does any one know the way to play, rtmp stream with attributes embded on a website?
Also if i have:
rtmp://$OPT:rtmp-raw=rtmp://xx.xx.xx.xx/live?idp=4050/rer_835660 playpath=rofl swfUrl=http://www.somewww.com/tv/swf/player.swf?file=redtofile&autostart=true&/2/3 live=1 pageUrl=http://www.somewww.com/tv/get_file.php
the real rtmp link is:
rtmp://xx.xx.xx.xx/live?idp=4050/rer_835660/rofl
some of rtmp will play if there is no token for swf player protection. That is why i need swfUrl and pageUrl added and sometimes Decrypt option.
Is it even possible? I know that vlc have some issues with playing such as url's.
//edit:
I know that my link does play in SimpleTV but i have to get it every time it changes. I have written php script so it fetches actual link for me as soon as I open my webpage. So i know its correct.
Just need to find way to play it, with anything, except SimpleTV.
Preferably Embed code for website, normal rtmp links i play via vlc plugin, but it does not support such as long rtmp links, example shown above. I might be wrong? That might be me could phase or construct correctly rtmp link.