在响应式网站上检测移动设备的最大视频分辨率支持 [英] Detect max video resolution support for a mobile device on responsive website

查看:236
本文介绍了在响应式网站上检测移动设备的最大视频分辨率支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所说,我正在寻找跨浏览器和大多数跨平台的解决方案,用于显示不同大小分辨率的 。我的主要问题是,如果从标准/低清设备访问高分辨率视频,它将无法播放,因为原生视频应用程序无法处理它;对于具有标准或低显示分辨率的旧/低预算Android设备,这种情况最为正确。

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.

我最好的猜测是根据以下内容过滤视频源文件设备宽度mediaquery,类似,如果宽度< 480 - >使用低分辨率视频但这可能会排除有能力的高端设备,如iphone,galaxyS2 +等等。

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..

最后我问是否有什么要查询,如最大视频分辨率支持或类似。我知道Android API中有一些东西,但我不知道它是否可以在这种情况下使用..

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

推荐答案

根据这篇文章,Android建议使用CamcorderProfile:
http://developer.android.com/指南/附录/ media-formats.html#推荐

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

他们说:


[...]设备的可用视频录制配置文件可用作媒体播放功能的代理。这些配置文件可以使用CamcorderProfile类进行检查,该类自API级别8开始可用。

[...] 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.

我现在也使用CamcorderProfile如下检测最大视频宽度和高度:

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);


起初我不认为这是一个很好的解决方案,因为某些设备需要获得在Android Manifest中使用相机权限的权限(对我来说这是HTC Evo 3D):

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/>

不幸的是我也认识到它无法正常工作,因为对于我的Nexus S,它说最大分辨率为480x720像素,但我能够播放来自 http://source.android.com/compatibility/downloads.html#cts-media-files
因此,zip档案中的文件夹和文件名为:
android-cts-media-1.0\bbb_short\1280x720\mp4_libx264_libfaac\bbb_short.ffmpeg.1280x720.mp4.libx264_1750kbps_30fps.libfaac_stereo_192kbps_48000Hz.mp4

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?

这篇关于在响应式网站上检测移动设备的最大视频分辨率支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆