我使用IronIO和Laravel 4.2将视频发布到Vimeo。
我的流程是
我已完成第1部分和第1部分2,但第3部分证明有点棘手,我不确定原因。
我的队列返回代码如下:
Event::listen('file.encode', function($data)
{
//create a new job
$j = new Job();
$j->status = 'queued';
$j->save();
$data['id'] = $j->id;
Queue::push(function($job) use ($data)
{
// Set a NEW Path...
$filePath = getcwd() .'/'. $data['post_media_path'];
// Now Process The Vimeo Stuff....
$upload = Vimeo::upload($filePath, false);
$video_data = Vimeo::request($upload);
if($video_data['status'] == 200)
{
$clip_id = str_replace(array("/", "videos"), "", $video_data['body']['uri']);
// Now Save The Video Data...
$post_media = PostMedia::find($data['post_media_id']);
$post_media->vimeo_clip_id = $clip_id;
$post_media->post_source = 'vimeo';
$post_media->save();
$ejob = Job::find($data['id']); // Find the job in database
$ejob->status = 'finished'; //Set job status to finished
$ejob->save();
// Now Send To Videos Controller (To Deal With Social Media Posting - If User has it setup)...
return Redirect::to('admin/post-social-media/'.$clip_id);
}
});
});
值得一提的是,如果我运行路线:
管理员/后社交媒体/ 1176758
所有数据都会发布到社交媒体上,所以它有效。但我正在调试路线代码的噩梦。我在重定向或类似方面做错了吗?
谢谢