Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect max video resolution support for a mobile device on responsive website

As the title says, I'm searching for cross-browser and mostly cross-platform solution for displaying html5 videos of different size resolutions. My main issue is that if a high resolution video is accessed from a standard/low definition device, it will not be played as the native video application can't handle it; this is mostly true on older/low-budget android devices, which have a standard or low display resolution.

My best guess was to filter the video source file based on the device width mediaquery, with something like if width < 480 --> use low-res video but this will probably exclude capable high end devices like iphones, galaxyS2+, and so on..

In the end I'm asking if there is something to query like "max video resolution support" or similar. I know there is something in the Android API, but I don't know if it can be used in this situation..

Below some links I've found for reference:

http://www.genuitec.com/mobile/docs/encodingVideo/encodingVideo.html http://developer.android.com/guide/appendix/media-formats.html#recommendations http://developer.android.com/reference/android/media/CamcorderProfile.html

like image 281
Gruber Avatar asked Jun 01 '13 14:06

Gruber


1 Answers

Android suggests to use CamcorderProfile for this according to this article: http://developer.android.com/guide/appendix/media-formats.html#recommendations

They say:

[...] a device's available video recording profiles can be used as a proxy for media playback capabilities. These profiles can be inspected using the CamcorderProfile class, which is available since API level 8.

I am now also using CamcorderProfile now as follows to detect maximum video width and height:

  CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
    Log.d(TAG, "Max Width: " + profile.videoFrameWidth);
    Log.d(TAG, "Max Height: " + profile.videoFrameHeight);

At first I don't think this is a good solution because some devices need a permission to use the camera permission for this in the Android Manifest (for me this was the HTC Evo 3D):

<uses-permission android:name="android.permission.CAMERA"/>

Unfortunately I also recognized that it does not work properly because for my Nexus S it says that the maxmium resolution would be 480x720 pixels but I was able to play a 1280x720 video from http://source.android.com/compatibility/downloads.html#cts-media-files More accordingly the folder and filename within the zip archive was: android-cts-media-1.0\bbb_short\1280x720\mp4_libx264_libfaac\bbb_short.ffmpeg.1280x720.mp4.libx264_1750kbps_30fps.libfaac_stereo_192kbps_48000Hz.mp4

Possibly this method helps you.

But I would appreciate any other method that fits better! Does anyone know another way?

like image 190
tsemann Avatar answered Nov 07 '22 04:11

tsemann