Created
December 12, 2016 15:37
-
-
Save bradorego/c9ea8b669d3b9d0914c4bf25184dcb3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var uploadVideo = function (file, title, description) { | |
var d = $q.defer(); | |
youtube.videos.insert({ | |
part: 'snippet,status', | |
resource: { | |
snippet: { | |
title: title, | |
description: description | |
}, | |
status: { | |
privacyStatus: "unlisted" | |
} | |
}, | |
media: { | |
mimeType: file.mimetype, | |
body: fs.readFileSync(file.path) | |
} | |
}, function (err, result, response) { | |
if (err) { | |
console.error(err); | |
return d.reject(err); | |
} | |
del.sync([file.path]); /// clean up file after upload success | |
//// save stuff to user records...which means I'll need to pass user info in | |
// var videoId = "J31_ux8XxFs", ///result.id, | |
// playlistId = "PLl-EhCUbHyIBAhfdPTrS7K35107IbjopG"; | |
d.resolve(result); | |
}); /// end video upload | |
return d.promise; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment