在我的代码上,我在 facebook 上发布了一个视频,这很好,但是我怎样才能获得该视频的 url?我需要将其存储在文件中,以便在其他时间向用户显示。在“响应”字符串中,有链接吗?我没找到办法...
这是“PostVideo”类的代码
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
fbRequestListener temp = new fbRequestListener();
InputStream is = null;
try {
is = new FileInputStream(dataPath);
data = readBytes(is);
param = new Bundle();
param.putString(Facebook.TOKEN, access_token);
param.putString("message", dataMsg);
param.putString("filename", ".mp4");
param.putString("title", TitoloCanzone);
param.putByteArray("video", data);
mAsyncRunner.request("me/videos", param, "POST", temp, null);
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
}
public byte[] readBytes(InputStream inputStream) throws IOException {
// This dynamically extends to take the bytes you read.
ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
// This is storage overwritten on each iteration with bytes.
int bufferSize = 1024;
byte[] buffer = new byte[bufferSize];
// We need to know how may bytes were read to write them to the byteBuffer.
int len = 0;
while ((len = inputStream.read(buffer)) != -1) {
byteBuffer.write(buffer, 0, len);
}
// And then we can return your byte array.
return byteBuffer.toByteArray();
}
//necessario per il caricamento dei video
@SuppressWarnings("deprecation")
class fbRequestListener implements AsyncFacebookRunner.RequestListener{
@Override
public void onComplete(String response, Object state) {
// TODO Auto-generated method stub
System.out.println("Caricamento completato ");
//Toast.makeText(getBaseContext(), "caricamento effettuato",Toast.LENGTH_LONG).show();
mDialog.cancel();
System.out.print(state.toString());
//System.out.println(response );
}
//here all the exception
}