Я пытаюсь загрузить видео на Youtube, используя Google API
, но не могу найти, куда я должен поместить видеофайл в качестве параметра.
Я пробовал разные вещино я всегда получаю ошибку: "mediaBodyRequired", "The request does not include the video content."
То, что у меня пока есть:
insertVideo() {
var filestream;
var reader = new FileReader();
// Gets Blob data from the video url
this.galleryService.getVideo(this.videoUrl)
.subscribe(data => {
reader.readAsDataURL(data);
});
reader.onloadend = function () {
filestream = reader.result;
gapi.client.youtube.videos
.insert({
part: 'snippet,status',
resource : {
snippet: {
title: 'Test video',
description: 'Testing the YouTube API',
},
status: {
privacyStatus: 'private'
}
},
}, filestream) // This is where it's supposed to be?
.then(response => {
console.log(response);
})
.catch(err => console.log(err));
}
}