访问Facebook上传文件时出错

时间:2014-03-04 11:10:09

标签: facebook actionscript-3 facebook-graph-api file-upload air

我正在尝试将视频上传到用户Facebook墙上我已经安装了FacebookMobile.uploadVideo并且似乎没问题但是我从Facebook收到以下错误:

(#353) You must select a video file to upload.

我认为问题在于出于某种原因访问视频文件。

public function handleUpload(ev:TouchEvent)
{
   trace ("posting to facebook"+  accessCamera.filePath);
   var videoInfo:Object = new Object;   
   videoInfo.title = "test upload on FB api",
   videoInfo.description = accessCamera.filePath,
   videoInfo.fileName =  accessCamera.filePath;
   videoInfo.video = accessCamera.filePath;
   FacebookMobile.uploadVideo('me/videos', onComplete, videoInfo);
}

private function onComplete( result:Object, fail:Object ):void
{
    trace("facebook post onComplete called" );
    if (result)
    {
        //result.id is id of post that was just posted
        trace ("great");
    }
    else if (fail)
    {
        trace("post Failed");  
        trace('code: '+fail.error.code); 
        trace('message: '+fail.error.message);
        trace('type: '+fail.error.type); 
    }
}

accessCamera.filepath是视频文件位于设备上的var,在跟踪时看起来像这样:file:///mnt/sdcard2/DCIM/Camera/VID_20140304_105813.mp4

我是否正确访问该文件,是否需要由应用程序加载或路径正常。 任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

问题是我将包含文件位置的字符串变量传递给params对象,而FacebookMobile.uploadVideo需要fileReferance或byteArray。