cordova - Telerik - Uploading Videos to Everlive, Unexpected Error -
i'm trying develop app in want able record video , i'm testing @ moment teleriks everlive service. takes me video camera on phone correctly after recording far i'm aware file should upload instead tells me upload everlive has failed , err.message "unexpected error". if tell me i'm doing wrong i'd appreciate it. thanks.
var capturesuccess = function (mediafiles) { mediaadded = true; var i, path, len; (i = 0, len = mediafiles.length; < len; += 1) { path = mediafiles[i].fullpath; alert(mediafiles[i].size); var file = { filename: math.random().tostring(36).substring(2, 15) + ".mp4", contenttype: "video/mp4", base64: mediafiles[i] }; el.files.create(file, function (response) { alert("photograph added."); }, function (err) { navigator.notification.alert("unfortunately upload failed: " + err.message); }); } }; function captureerror() { alert("video not captured"); } navigator.device.capture.capturevideo(capturesuccess, captureerror, { limit: 1, duration: 20 });
i have managed make working. have started media capture sample here - http://docs.telerik.com/platform/samples/sample-capture/. have added index.html file script tag everlive.sdk.min.js
<script src="https://bs-static.cdn.telerik.com/latest/everlive.all.min.js"></script>
then modified captured success function, clarity testing capture video, hardcoded mime type , file name.
_capturesuccess:function(capturedfiles) { var i, media = document.getelementbyid("media"); media.innerhtml = ""; (i=0;i < capturedfiles.length;i+=1) { media.innerhtml+='<p>capture taken! path is: ' + capturedfiles[i].fullpath + '</p>' } var el = new everlive('your-app-id'); var options = { filename: 'testvideo.mov', mimetype: 'video/quicktime' }; el.files.upload(capturedfiles[0].fullpath, options) .then(function() { console.log('success'); }, function(err) { console.log(json.stringify(err)); }); },
then comes important thing - must include file transfer cordova plugin - https://github.com/apache/cordova-plugin-file-transfer because everlive sdk assumes present when tries upload file. when plugin not included, result yours - neither usccess nor error callback fired, because there error in sdk itself. after have included plugin, sdk uploaded video. here result:
i think going app
Comments
Post a Comment