我正在开发一款应用程序,可以记录视频并上传到YouTube和其他社交网站。
我使用Droid共享功能进行上传,并且它运行良好。
在电子邮件、Facebook、Skype等应用中,上传工作完美,但当我选择YouTube时,它无法上传我的视频。
这是我用于视频分享的代码。
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"SUBJECT_NAME");
sharingIntent.setType("video/*");
File newFile = new File(video_path);
sharingIntent.putExtra(android.content.Intent.EXTRA_STREAM,Uri.fromFile(newFile));
startActivity(Intent.createChooser(sharingIntent,"Where you want to share?"));