本文介绍了是否可以使用ReactVR链接到360 YouTube视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它演示了在代码库中指向视频的过程。

it demonstrates pointing to a video in the code base.

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

Is it possible to link to an external link (aka Youtube)?

所以不是video.mp4 ,它将链接到

So instead of video.mp4, it would link to 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';
  }
}

其余的代码如下所示。

the rest of the code looks like this.

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 (没有用)



您可以尝试使用嵌入视频:。这只会为您提供不含其他内容的视频。

Solution 1 (didn't work)

You could try to use an embed the video: https://www.youtube.com/embed/hkgYIr_LWPw. This will give you just the video without other content.

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

If you need a embedded video, just left click on the video and choose "embed this video" and change the source of your

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

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

Not sure if this could wok because the source code is again HTML, JS and CSS. But you could give it a try. And it didn't work

使用 或其他下载器,并使用它。

Download the video using a YouTube downloader or other one and use that.

<VideoPano playerState={this.state.playerState}
            source={ asset(videoUrl, { layout: 'SPHERE' }) } />

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

No publicity for that tool, just the first result I've found on Google.

这篇关于是否可以使用ReactVR链接到360 YouTube视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 19:16