Youtube API, nexturl and XMLHttpRequest - ajax

I've managed to upload a video to YouTube via CORS and XMLHttpRequest so that I can provide a progress bar on the uploads. However after the upload gets to 100% and the video appears in the YouTube channel, the error handler is called.
I think this is to do with the nextUrl parameter which has to be provided as part of the form action. Has anyone come across this and does anyone have a workaround?
I've seen this (Can I upload to youtube without a full page refresh using FormData?) on StackOverflow but it doesn't help as I don't want to host the videos on our servers.
Cheers
Simon

Related

YouTube video is blocked even with a verified app

Context: using googleapis (more specifically youtube.videos.insert method) to upload a video to YouTube. The video is successfully uploaded but it is private (locked). I'm aware about the verification and I already went through it. My app is verified.
However, I'm still getting this when I upload a video.
Any ideas?
I also just submitted this form https://support.google.com/youtube/contact/yt_api_form (waiting for a response)
Edit #1:
I got an answer from YouTube API Service Team that my API client is not compliant to this document https://developers.google.com/youtube/terms/api-services-terms-of-service with a couple of suggestions how to fix the problems. I'll do today and will email them back. So, the bottom line is - we have to verify our app so we can publish and we have to be fill that form above to make our API client verified.
P.S.
this same question is also published here https://support.google.com/youtube/thread/111169095/video-uploaded-via-the-api-appears-as-private-locked-even-tho-my-app-is-verified?hl=en

Getting a 403 error with Google Drive API v3, the request is not updated in Google API Metrics

I am using Google Drive API to load videos in HTML5 video player.
<video id='drive-video' width='100%' height='100%' preload='metadata' playsinline>
<source src='https://www.googleapis.com/drive/v3/files/<videoId>?alt=media&key=<api_key>' type='video/mp4'>
</video>
This works fine. However, when I am watching the video and doing different operations like going forward/backward etc., the video goes blank and I am unable to watch the video for about 15min. After that the video again plays and the same problem continues.
I tried to refresh the page and noticed that the GET request for the video using API is throwing a 403 error. I have checked the Google Chrome Network tab and did not see any response for this request.
Console Error
Google API Quota
Google API Response Headers from Chrome Network Tab
Google API Response from Chrome Network Tab
Also, one weird thing is, when I get the 403 errors, I am not able to see any traffic in my Google Drive Metrics for this API key. It is as if the request is not being sent to Google.
Any help is appreciated.
As #DaImTo points out Google drive is a file directory access API. You should host the videos on YouTube for optimal playback.

Get currently playing video in Youtube

I need to get the title of the currently playing video in my Firefox browser from an external app using youtube API, or at least my last played video in my YT account. The goal is to get the name of the song i'm listening to and putting it in a file. I've got another app (using Discord API) that will read it and use it.
My first idea was to get the watch history, but this function was removed from the API since late 2016.
I managed to authentificate my Google application to access my own channel with Oauth 2.0, but from here I'm stuck. There don't seem to be any request that gets your own last watched video.
I also thought of a completely different way, by using a Firefox extension to get the title, but storing it and passing it to the other app will not be an easy thing (localStorage and sessionStorage are both in AppData folder, and my other app can't access it).
Does anybody know a way to do this? I'm starting to be kind of desperate.
I was looking for something similar and came across this in my search: Cross-Domain Cookies
Sharing cookies between 2 applications via a 3rd party might be of help here although it would complicate things.

In Brightcove, can I retrieve a video's thumbnail WITHOUT a media API token?

I would like to use Javascript to retrieve thumbnail URLs from Brightcove-hosted videos.
I can't see a way to do that without exposing my Media API token to the client browser. (The with-token method is documented here.)
I don't need a token to show the whole video, so it seems insane and unnecessary that I need a token to get the thumbnail url, which obviously I would want to show to the user anyway.
The only workaround I can devise is to create a middleman interface on the server. (The client JS makes a request to my server, which uses the token to request the thumbnail from BC, then returns it back to the JS.) That's just annoying.
Am I missing something? Is there an alternate way to retrieve video thumbnails in the client without exposing the Media API key?
According to Brightcove's support, they tell me that the answer is "NO".
They do recommend a server-side relay, which is what I ended up writing, and it works fine.
Disappointing, though.

Can a video be updated while insertion/upload is still in progress with the YouTube v3 API?

My .NET client application needs to upload a video for which the title, description and custom thumbnail are not available at upload time. This metadata becomes available to my application at an indeterminate time after upload begins.
When this metadata becomes available to my application, would it be possible for me to update the video even if the initial upload is still in progress? It seems as though it would be possible if I had the video ID. However, (as far as I can tell) the video ID is not made available to me until after the video is uploaded.
As of now, there's no mentioned way to do this!
A possible solution is to set the video to being "unlisted" or "private"
and then, after the upload finishes, push your information with a second request (update request).
YouTube could probably handle change requests during uploads, but as you mentioned, there's no way to receive the videoID prior to upload end.

Resources