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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 08:20:16

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?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!