play video from android internal storage -


i'm trying play video files stored in android internal memory through intent. files exist there when try play them through intent, give me error "media file not supported" or "can't play video" depending on device. couldn't find i'm wrong. here code

file mydir = activity.getdir("videos", context.mode_private); file filewithinmydir = new file(mydir, filename); string videoresource = filewithinmydir.getpath(); uri intenturi = uri.parse(videoresource);  intent intent = new intent(); intent.setaction(intent.action_view); intent.setflags(intent.flag_activity_new_task); intent.setdataandtype(intenturi, "video/mp4"); startactivity(intent); 

i don't know i'm wrong , should do. appreciated. thank :)

thank friends participation, efforts appreciated. i'v found solution of problem. there need set file read true before playing it.

filewithinmydir.setreadable(true, false); 

now here complete code of intent play mp4 video internal storage of android.

file mydir = activity.getdir("videos", context.mode_private); file filewithinmydir = new file(mydir, headingslist.get(mposition)); filewithinmydir.setreadable(true, false); string videoresource = filewithinmydir.getpath(); uri intenturi = uri.fromfile(new file(videoresource));  intent intent = new intent(); intent.setaction(intent.action_view); intent.setflags(intent.flag_activity_new_task); intent.setdataandtype(intenturi, "video/mp4"); startactivity(intent); 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -