麻烦与YouTube上传 [英] Trouble with youtube upload
本文介绍了麻烦与YouTube上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要上传使用intents.The问题,在YouTube上的视频是视频没有在YouTube分享仅在Gmail中完美的工作,blutooth等..在code我现在用的就是
I am trying to upload a video in youtube using intents.The problem is the video is not sharing in the youtube only working perfectly in gmail,blutooth etc,.. The code I am using is
Log.d("Share Example", "Share button is clicked");
String outputFile = pathOfSelected;
Log.d("Share Example", "outputFileURL: " + outputFile);
ContentValues content = new ContentValues(4);
content.put(Video.VideoColumns.TITLE, "My Test");
content.put(Video.VideoColumns.DATE_ADDED,
System.currentTimeMillis() / 1000);
content.put(Video.Media.MIME_TYPE, "video/mp4");
content.put(MediaStore.Video.Media.DATA, outputFile);
ContentResolver resolver = getContentResolver();
Uri uri = resolver.insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
content);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("video/*");
intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(intent, "Share using"));
有人请帮我梳理出来
Somebody please help me to sort it out
推荐答案
试试这个工作对我来说
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("video/*");
ContentValues content = new ContentValues(4);
content.put(Video.VideoColumns.DATE_ADDED,
System.currentTimeMillis() / 1000);
content.put(Video.Media.MIME_TYPE, "video/mp4");
content.put(MediaStore.Video.Media.DATA, share_outputFileName);
ContentResolver resolver = getBaseContext().getContentResolver();
Uri uri = resolver.insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, content);
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT,getString("");
sharingIntent.putExtra(android.content.Intent.EXTRA_TITLE,getString("");
sharingIntent.putExtra(android.content.Intent.EXTRA_STREAM,uri);
startActivity(Intent.createChooser(sharingIntent,"Share video"));
这篇关于麻烦与YouTube上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文