Search code examples
androidxamarinxamarin.androidvideo-streamingsamsung-galaxy

What can be the reason a video can not be played on certain devices?


I'm working on an Xamarin app that allows the user to create messages with 4 different content types [text, images, sounds, videos].

Everything worked fine before adding videos to the mix.

Files are being sent and stored in a blob database. And it works fine on most of our devices like:

  • LG Nexus 5 (???)
  • LG Nexus 5X (8.0)
  • Samsung Galaxy S3 Neo (4.4.2)

But somehow it doesn't work on our Samsung Galaxy S7 (7.0) and Samsung Galaxy S4 (???).

On the first devices I can make/select videos and send them to the server and they will be playable in an Android VideoView on all the other devices (even the SGS7 and SGS4). The videos are made with the external camera app.

When I make/select the videos with the SGS7/SGS4 the videos are playable in the preview. But after they are send to the server and you try to read the message the video won't play on any of the devices (not even the devices that made them). But the video does exists as it's URL is playable in the browser.

I've been debugging the whole day and nothing looks extraordinary. I don't get any errors when sending the files.

Any idea on where this could go wrong and why most of the devices are working just fine?


Solution

  • The ExoPlayer is probably your best bet for this. It's also used by the Xamarin.Forms MediaPlayer plugin.

    Regarding streaming from Azure Storage, this blog post had some very helpful information for me as my Android application would crash if we tried to scrub the videos:

    1. The media-content type is properly set on the media. mp4 video should have a mime-type of "video/mp4"
    2. The media files themselves can be an issue. H.264 encoded files can sometimes have the index at the end of the file, which means the entire file must be downloaded before playing.
    3. Your Azure Storage version view here may need to be updated if you're using an older system. The x-ms-version header should be greater than 2012-02-12