MP4 local video not playing

Hi,

I want to play a video in a box on top of my app (not in a separate player) as a quick tutorial.

The video is a MP4 file, 324x480, H.264 AVC. It is stored in the main project folder along with main.lua.

When I use this code on (Android) device I get a “cannot play video” error.

 local vide = native.newVideo( display.contentCenterX, display.contentCenterY, 324, 480 ) vide:load("11tut.mp4") vide:play()

Any ideas why that happens? 

H.264 AVC should play. Android supports that an MPEG-4 encoding in a .mp4 wrapper (see: https://forums.coronalabs.com/topic/71142-videoload-not-working-on-android/))

What version of Android and what device are you testing on? It may not have the right codec’s installed.

Rob

Give this a try and see if it works for you. 

https://github.com/roaminggamer/RG_FreeStuff/blob/master/AskEd/2017/12/video.zip

Built with 2017.3160

https://github.com/roaminggamer/RG_FreeStuff/blob/master/AskEd/2017/12/video.apk

If it does, consider running your video through handbrake: 

https://handbrake.fr/

@Rob Miracle

Admittedly I was using a Moto G running Android 7.0 to ensure compatibility but it turned out not to be the issue.

@roaminggamer

Actually it played when reencoded with handbrake. Thanks, turns out there must have been something wrong with the encoding.

VLC works?

What are you trying to say.  Please post a little bit more detail.

H.264 AVC should play. Android supports that an MPEG-4 encoding in a .mp4 wrapper (see: https://forums.coronalabs.com/topic/71142-videoload-not-working-on-android/))

What version of Android and what device are you testing on? It may not have the right codec’s installed.

Rob

Give this a try and see if it works for you. 

https://github.com/roaminggamer/RG_FreeStuff/blob/master/AskEd/2017/12/video.zip

Built with 2017.3160

https://github.com/roaminggamer/RG_FreeStuff/blob/master/AskEd/2017/12/video.apk

If it does, consider running your video through handbrake: 

https://handbrake.fr/

@Rob Miracle

Admittedly I was using a Moto G running Android 7.0 to ensure compatibility but it turned out not to be the issue.

@roaminggamer

Actually it played when reencoded with handbrake. Thanks, turns out there must have been something wrong with the encoding.

VLC works?

What are you trying to say.  Please post a little bit more detail.