android - Share Intent does not work for uploading video to youtube -


i trying share video being created , stored on external sdcard path has been obtained by.

environment.getexternalstoragepublicdirectory(environment.directory_movies).getabsolutepath() 

i using send_intent follows:

intent shareintent = new intent(intent.action_send);                          shareintent.addflags(intent.flag_activity_clear_when_task_reset); shareintent.settype("video/mp4"); shareintent.putextra(android.content.intent.extra_subject, "my subject"); shareintent.putextra(android.content.intent.extra_text,"my text"); shareintent.putextra(intent.extra_stream, uri.parse(video_path)); startactivityforresult(intent.createchooser(shareintent, "share video"),share_intent); 

problem: while share through gmail, shows me compose window video attached. no size being shown of video , when either send or cancel window, gmail crash inputstream npe on contentresolver.

in case of youtube, says cannot upload videos cloud service, video resides on device.

in case of facebook, silently discarded. works fine wassup. :-)

any ideas how work?

edit:

video path: /storage/emulated/0/movies/myfolder/my-video_1378253389208.mp4

update

by adding file:/// suffix, gmail , facebook works fine. youtube still cribbing "videos cannot uploaded cloud services".

the reason youtube fails , others work because checks see if media file. thinks media file if has been scanned. run code below , should work. show in gallery. how upload temp file not know.

void publishscan() {      //mvidfnam: "/mnt/sdcard/dcim/foo/vid_20131001_123738.3gp" (or such)     mediascannerconnection.scanfile(this, new string[] { mvidfnam }, null,             new mediascannerconnection.onscancompletedlistener() {                 public void onscancompleted(string path, uri uri) {                     log.d(tag, "onscancompleted uri " + uri);                   }             }); } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -