youtube - 是否可以使用ReactVR链接到360 YouTube视频?

标签 youtube webvr 360-virtual-reality react-360

在ReactVR for VideoPano的文档中

它演示了如何在代码库中指向视频。

是否可以链接到外部链接(又名Youtube)?

因此,它将代替video.mp4链接到https://www.youtube.com/watch?v=hkgYIr_LWPw&index=1&list=PL-BE7kqSgbEj44peyt5BmLK63kbDp7Rhu

let videoUrl = 'video.webm';
const supportedFormats = NativeModules.VideoModule.supportedFormats;
for (let i = 0; i < supportedFormats.length; i++) {
  if (supportedFormats[i] === 'mp4') {
    videoUrl = 'video.mp4';
  }
}

其余代码看起来像这样。
class WelcomeToVR extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      playerState: new MediaPlayerState({autoPlay: true, muted: true}), // init with muted, autoPlay
    };
  }
  render() {
    return (
           <View>
           <VideoPano
    playerState={this.state.playerState}
  source={asset(videoUrl, {layout: 'SPHERE'})}
         />
         <VideoControl
  style={{
  height: 0.2,
          width: 4,
                 layoutOrigin: [0.5, 0.5, 0],
  transform: [{translate: [0, 0, -4]}],
}}
playerState={this.state.playerState}

最佳答案

解决方案1(无效)

您可以尝试使用嵌入视频:https://www.youtube.com/embed/hkgYIr_LWPw。这只会给您视频而没有其他内容。

如果您需要嵌入式视频,只需在视频上单击鼠标左键,然后选择“嵌入此视频”并更改您的源

<VideoPano playerState={this.state.playerState} source={videoUrl} />

由于源代码还是HTML,JS和CSS,因此不确定是否可以启动。但是您可以尝试一下。而且没有用

解决方案2

使用YouTube downloader 1或其他下载视频,然后使用它。
<VideoPano playerState={this.state.playerState} 
            source={ asset(videoUrl, { layout: 'SPHERE' }) } />

1没有宣传该工具,只是我在Google上找到的第一个结果。

关于youtube - 是否可以使用ReactVR链接到360 YouTube视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43576301/

相关文章:

youtube - 没有iframe,Three.js,A帧的YouTube视频

video - 使用 FFmpeg v360 过滤器对 180 个 VR 素材进行变形

wordpress - 在Wordpress中使用MediaElement.js 2.9.1显示YouTube视频?

python - 如何使用 python 在我的 youtube 历史记录中获取最后观看的视频?

javascript - YouTube ID 的正则表达式

three.js - AFrame:如何将相机渲染到纹理

javascript - krpano项目无法进入VR模式

android - 有没有办法将 youtube 360​​ 视频嵌入到 Android 中

ffmpeg - 如何使用 ffmpeg 更改 360 视频投影?

video - 如何从嵌入式视频中完全删除 youtube 品牌?