18
votes

I have upload and play videos on both Android and iPhone devices but video uploaded from iPhone is not working on Android.it's not play in android video player. It's give me error message

"sorry this video can not be played"

video is in mp4 format.

2
Please check the format types supported on server and also in your app's code. If .mov is not supported please add it :) - Ashutosh
@Ashutosh video befour post on server it is convert in to mp4 format. - user2524618
can this video be played in iOS device? - Ashutosh
yes, ios can play that video and also play all the videos posted from android device.only ios posted video can't play in android device. - user2524618
then you should go with Biraj Zalavadia's ans.. - Ashutosh

2 Answers

10
votes

Yes, That's right.

It happens because the android support limited codecs in-built like mp3,mp4,mpeg.

While iphone support most of codecs.

What is the way to resolve this?

MP4 for video and MP3 for audio are widely accepted and work on both platforms.

So you need do some stuff at the server. Implement the ffmpeg library that will convert all the videos to MP4 and audio to MP3.

We are doing same mechanism to resolve this issue.

Find FFMPEG implementation for PHP Here and

Command to convert all videos to MP4 Here Hope this helps you.

Thanks.

9
votes

If it is mp4, then you need to check what codecs are used. iPhone usually encodes everything in h264, however, there are different profiles of h264 and high profiles might not be supported on Android, because they are more complex for decoding.

Even apple says in their documentation:

H.264 Baseline Level 3.0, Baseline Level 3.1, Main Level 3.1, and High Profile Level 4.1.

iPad, iPhone 3G, and iPod touch (2nd generation and later) support H.264 Baseline 3.1. If your app runs on older versions of iPhone or iPod touch, however, you should use H.264 Baseline 3.0 for compatibility. If your content is intended solely for iPad, Apple TV, iPhone 4 and later, and Mac OS X computers, you should use Main Level 3.1.

Baseline profile should be played everywhere.

See the list here - http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles

So if you have control over encoding (if the video is recorded from your iOS application), then you can do it programmatically. I just googled and found a piece of code where the profile is set: http://forums.macrumors.com/archive/index.php/t-1512924.html