gpt4 book ai didi

android - 在响应式网站上检测移动设备的最大视频分辨率支持

转载 作者:可可西里 更新时间:2023-11-01 03:58:20 24 4
gpt4 key购买 nike

正如标题所说,我正在寻找用于显示 不同大小分辨率 的 html5 视频的跨浏览器和主要是跨平台的解决方案。我的主要问题是,如果从标准/低清晰度设备访问高分辨率视频,则不会播放,因为 native 视频应用程序无法处理;这在具有标准或低显示分辨率的旧款/低预算 Android 设备上大多如此。

我最好的猜测是根据设备宽度媒体查询过滤视频源文件,使用类似 if width < 480 --> use low-res video 的东西但这可能会排除 iphone、galaxyS2+ 等功能强大的高端设备。

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

下面是我找到的一些供引用的链接:

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/guide/appendix/media-formats.html#recommendations

他们说:

[...] 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 来检测最大视频宽度和高度:

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

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

不幸的是,我也意识到它无法正常工作,因为对于我的 Nexus S,它表示最大分辨率为 480x720 像素,但我能够播放来自 http://source.android.com/compatibility/downloads.html#cts-media-files 的 1280x720 视频。更相应地,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

可能这个方法对你有帮助。

但如果有其他更合适的方法,我将不胜感激!有人知道另一种方法吗?

关于android - 在响应式网站上检测移动设备的最大视频分辨率支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16873883/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com