RequestAsyncTask of Facebook sdk not working for posting video in android -
{ request request = null; requestasynctask task = null ; bundle requestparams requestparams=new bundle(); byte[] data = downloadurl(new url("urltodownload")); requestparams.putbytearray("video", data); requestparams.putstring("title", "video post"); requestparams.putstring("description", " #sometag"); request = new request(session.getactivesession(),"me/videos" , requestparams, httpmethod.post,new request.callback() { @override public void oncompleted(response response) { //applink=null; if (response.geterror() == null) { logs.e(debug_facebook_publish, "publish success"); if (uploadlistener != null) { uploadlistener.onsuccess(null); } } else { logs.e(debug_facebook_publish, "publish error: " + response.geterror().geterrormessage()); logs.e(debug_facebook_publish, "publish error: " + response.geterror().tostring()); if (uploadlistener != null) { uploadlistener .onerror("facebook can't publish content"); } } } }); task = new requestasynctask(request); task.execute(); } private static byte[] downloadurl(url todownload) { bytearrayoutputstream outputstream = new bytearrayoutputstream(); try { byte[] chunk = new byte[4096]; int bytesread; inputstream stream = todownload.openstream(); while ((bytesread = stream.read(chunk)) > 0) { outputstream.write(chunk, 0, bytesread); } } catch (ioexception e) { e.printstacktrace(); return null; } return outputstream.tobytearray(); }
{httpstatus: 500, errorcode: 352, errortype: facebookapiexception, errormessage: sorry, video file selected in format don't support.}
i don't know doing wrong every time got error. there other method post video facebook wall. know how post video newuploadvideorequest method in case don't want download video , save sd card post facebook . there other way can call graph api url , post video facebook wall is there other method can directly post video facebook wall , referes every link
i change
requestparams.putbytearray("video", data); requestparams.putbytearray("video.3gp", data);
and uploaded can try .mp4 strange there no helpful documentation regarding should pass in parameters .hope helpful
Comments
Post a Comment