Ionic, Android and video formats


#1

Hi there
I’m currently working on an app for iOS and Android with a lot of local video content. The videos have to be part of the app (required by the client). So I used the video tag with

<video controls="controls" preload="metadata" class="videoPlayer">
     <source ng-src="{{video.src}}" type="video/mp4"/>
</video>

{{video.src}} in this case contains the string video/_demo_video.mp4

On iOS the whole thing works like a charm. But on Android the videos don’t work. There is a video thumbnail, but tapping on it doesn’t play the video. On the smartphone itself nothing happens. In the emulator (with ‘ionic emulate android’) the app quits unexpectedly.

The videos are in an mp4 containter with H264 - MPEG-4 AVC 4:2:0 encoding and mp4a MPEG AAC audio. According to the supported media formats of android, this should work: http://developer.android.com/guide/appendix/media-formats.html

Does anybody have an idea what I could do about that?


#2

I’m not sure if this applies to videos, but for playing local audios on Android you sometimes need to set the directory as /android_asset/www/audios/myaudio.mp3.’ Something like:

if ($ionicPlatform.is('android')) { src = '/android_asset/www/' + $scope.it.audio; }

Maybe this might be relevant: https://github.com/jaeger25/Html5Video


#3

Thanks @praxis
Sadly it didn’t work… still looking for the problem. I’m trying another video format now with .ogg


#4

tried ogg and even webm. Didn’t work. I’m clearly doing something wrong here. On the device is Android 4.4.2 installed.
Question: Does anybody got video in an ionic app on android working where the source was internal and not over the internet?


#5

I wonder how have you solved it? All around the internet I only see the problem, with no solution!!


#6

I have the same problem