在 Cardboard 模式下播放 Youtube 视频
Play Youtube Video in Cardboard mode
我正在开发一个纸板应用程序。在我的应用程序中,我想播放 360 度全景 youtube 视频,我希望它直接进入 VR 模式,这样用户就不必取下他们的耳机。
我不介意这个视频是嵌入我的应用程序还是打开 youtube 应用程序,但我需要它直接进入 VR 模式,没有非 VR 交互。
我研究了以下操作:
- 将视频流式传输到 surfaceTexture 并使用它进行立体渲染:not Possible
- 以纸板模式启动 YouTube 应用程序:Not Possible
- 使用 YoutubePlayerView/Fragment/standalonePlayer : None 公开功能以启用纸板模式。
这可能吗?
我最终在 exoplayer 中使用了 DASH。
我是这样直接抓取的url:
String GET_VIDEO_INFO_URL = "http://www.youtube.com/get_video_info";
Bundle params = new Bundle();
params.putString("video_id", info.getId());
UrlUtils.HttpURLRequest request = new UrlUtils.HttpURLRequest(GET_VIDEO_INFO_URL, "GET", params);
String response = request.execute();
if(response != null) {
Bundle urlParams = UrlUtils.decodeUrl(response);
String manifest_url = urlParams.getString("dashmpd", null);
info.setPath(manifest_url);
}
然后我使用 exoplayer 将破折号流渲染为纹理,如解释的那样 here。
我正在开发一个纸板应用程序。在我的应用程序中,我想播放 360 度全景 youtube 视频,我希望它直接进入 VR 模式,这样用户就不必取下他们的耳机。
我不介意这个视频是嵌入我的应用程序还是打开 youtube 应用程序,但我需要它直接进入 VR 模式,没有非 VR 交互。
我研究了以下操作:
- 将视频流式传输到 surfaceTexture 并使用它进行立体渲染:not Possible
- 以纸板模式启动 YouTube 应用程序:Not Possible
- 使用 YoutubePlayerView/Fragment/standalonePlayer : None 公开功能以启用纸板模式。
这可能吗?
我最终在 exoplayer 中使用了 DASH。
我是这样直接抓取的url:
String GET_VIDEO_INFO_URL = "http://www.youtube.com/get_video_info";
Bundle params = new Bundle();
params.putString("video_id", info.getId());
UrlUtils.HttpURLRequest request = new UrlUtils.HttpURLRequest(GET_VIDEO_INFO_URL, "GET", params);
String response = request.execute();
if(response != null) {
Bundle urlParams = UrlUtils.decodeUrl(response);
String manifest_url = urlParams.getString("dashmpd", null);
info.setPath(manifest_url);
}
然后我使用 exoplayer 将破折号流渲染为纹理,如解释的那样 here。