React Native中的Vimeo视频

时间:2017-06-13 01:35:00

标签: react-native video-streaming vimeo react-native-android vimeo-api

我正在开发电视节目React-Native 应用,我正在 Vimeo 中托管我的视频,所以我只能我的视频的Vimeo网址。 我正在使用 react-native-video 作为视频播放器,但它不显示这些链接的视频另一方面,我尝试使用VJS URL并且它可以工作。

我会感激任何想法。

1 个答案:

答案 0 :(得分:1)

我会假设一些事情,如果我弄错了,请告诉我。

如果您尝试在原生视频播放器上播放视频,则需要使用直接视频播放器链接。当您点击Video's settings -> Video File

时,可以通过vimeo界面找到这些链接
  1. 高清1080p(mp4,1920x1080)
  2. High Def(mp4,1280x720)
  3. 标准版(mp4,960x540)
  4. 标准版(mp4,640x360)
  5. HTTP直播(了解详情)
  6. 当您使用此API获取有关特定视频的信息时,JSON响应中也会提供这些链接:

    GET https://api.vimeo.com/videos/{video_id}
    

    它们位于响应中的“文件”下。

    {
        //More data here
        "files": [
                {
                    "quality": "hd",
                    "type": "video/mp4",
                    "width": 1920,
                    "height": 1080,
                    "link": "",
                    "created_time": "",
                    "fps": 50,
                    "size": 0,
                    "md5": "",
                    "link_secure": ""
                },
                {
                    "quality": "hd",
                    "type": "video/mp4",
                    "width": 1920,
                    "height": 1080,
                    "link": ",
                    "created_time": "",
                    "fps": 25,
                    "size": 0,
                    "md5": "",
                    ""
                },
                {
                    "quality": "sd",
                    "type": "video/mp4",
                    "width": 960,
                    "height": 540,
                    "link": "",
                    "created_time": "",
                    "fps": 25,
                    "size": 0,
                    "md5": "",
                    "link_secure": ""
                },
                {
                    "quality": "sd",
                    "type": "video/mp4",
                    "width": 640,
                    "height": 360,
                    "link": "",
                    "created_time": "",
                    "fps": 25,
                    "size": 0,
                    "md5": "",
                    "link_secure": ""
                },
                {
                    "quality": "hd",
                    "type": "video/mp4",
                    "width": 1280,
                    "height": 720,
                    "link": "",
                    "created_time": "",
                    "fps": 50,
                    "size": 0,
                    "md5": "",
                    "link_secure": ""
                },
                {
                    "quality": "hls",
                    "type": "video/mp4",
                    "link": "",
                    "created_time": "",
                    "fps": 50,
                    "size": 0,
                    "md5": "",
                    "link_secure": ""
                }
            ]
       //More data here
      }
    

    我建议使用HLS链接,因为它会根据用户的网速自动调整视频质量。