Android Question Got error msg "Sorry, this video cant be played" with good mp4

Lingling He

New Member
Licensed User
Longtime User
Hi, When I try to use videoview with the folowing code I get this error message "Cannot play video", "Sorry, this video cannot be played"


Sub Globals
Dim vv As VideoView
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1")
vv.Initialize("vv")
Activity.AddView(vv, 10dip, 10dip, 250dip, 250dip)
vv.LoadVideo(File.DirRootExternal, "skyclouds_converted.mp4")
vv.Play

End Sub

I can play "skyclouds_converted.mp4" directly with my LG cell phone VideoPlayer without problem.
Hope that someone can tell me where I'm going wrong.
Thanks in advance.
 

Attachments

  • b4a_tt.apk
    112.2 KB · Views: 247

Lingling He

New Member
Licensed User
Longtime User
How can I include the video file into the APK(thought the "release run" would include it in APK for me)? I added the line(bold) below, but still not working.

Activity.LoadLayout("Layout1")
vv.Initialize("vv")
Activity.AddView(vv, 10dip, 10dip, 250dip, 250dip)

File.Copy(File.DirAssets, "skyclouds_converted.mp4", File.DirRootExternal, "skyclouds_converted.mp4")

vv.LoadVideo(File.DirRootExternal, "skyclouds_converted.mp4")
vv.Play

BTW, I got the error: java.io.FileNotFoundException with the code above.
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Have you added the MP4 file to your assets?, on the IDE, on the bottom right you will see a tab named FILES, click there then click on the ADD FILES button, search for your file and then compile.

I would suggest you copy the file to DirDefaultExternal, that way, when you uninstall the app you also remove that file or it will take unnecessary storage space.
 
Last edited:
Upvote 0
Top