Hello,
Video i am trying to upload is 152Kb in size and around 16 seconds of length.
This is the function i have written.
function uploadVideo() {
Token.post('media/upload', { command: "INIT", media_type: "video/mp4", total_bytes: 152000 }, function (error, media, response) {
if (error) {
console.log(error);
}
else {
var mediaObject = media;
Token.post('media/upload', { command: "APPEND", media_id: mediaObject.media_id_string, segment_index: 0, media: "/Users/mukeshagicha/Documents/workspace/buzz-twitter-crawl/sample-video.mp4" }, function (error, media, response) {
if (error) {
console.log(error);
} else {
console.log(response.statusCode);
Token.post('media/upload', { command: "FINALIZE", media_id: mediaObject.media_id_string}, function (error, media, response) {
if (error) {
//getting error here
console.log(error);
} else {
console.log('successfully created media');
//TO DO: api to post status with media
}
});
}
});
}
});
}