1
votes

Im here to ask if it's possible to fully use youtube data api v3 with angular 2+, the documentation just have examples from javascript like authentication, playlist videos, insert a playlist and search of videos (samples)

I'm trying to upload a video, using parameter like:

(gapi.client as any).youtube.videos.insert({
    "resource": {
        // Video title and description
        "snippet": {
            "title": "Test",
            "description": "Test video upload via YouTube API"
        },
        "status": {
            "privacyStatus": "private"
        }
    }, 
    "part": "snippet,status,id", 
    "media": {
        "body": video
    })

My problem is that even like this, it always return error 404 : "The request does not include the video content.", documentation says the videos needs to be video/* or application/octet-stream, and my video object is a File extended from Blob.

What could i'm possibly doing wrong? If it's the video file, what I have to do to work?

PS: "(gapi.client as any).youtube" has this any, because youtube is not a property from the interface, its loaded.

1

1 Answers

0
votes

Solved I'm brazilian then I was searching portuguese documentation, that is quite poor, when changed to English, I found 2 archives cors_upload.js and upload_video.js JS samples in the documentation, converted then to typescript and now it works.