diff --git a/components/Video/Video.js b/components/Video/Video.js index 36ba6662..87760f54 100644 --- a/components/Video/Video.js +++ b/components/Video/Video.js @@ -8,8 +8,7 @@ import { connectStyle } from '@shoutem/theme'; import VideoSourceReader from './VideoSourceReader'; -function createSourceObject(source, playerParams, poster) { - const sourceReader = new VideoSourceReader(source.uri, playerParams); +function getSource(sourceReader, poster) { const url = sourceReader.getUrl(); if (sourceReader.isEmbeddableVideo()) { @@ -57,23 +56,34 @@ class Video extends PureComponent { }, }; + constructor(props) { + super(props); + + const { source, playerParams } = props; + this.sourceReader = new VideoSourceReader(source.uri, playerParams); + } + render() { const { width, height, - source, style, - playerParams, poster, } = this.props; + // https://github.com/vimeo/player.js/issues/514 + // Vimeo player crashes the app, if played in full screen portrait mode and if user + // tries to navigate back using Android hardware back button. Disableing full screen + // option for Vimeo until their player is fixed. + const isYoutubeVideo = this.sourceReader.isYouTube; + return ( diff --git a/components/Video/VideoSourceReader.js b/components/Video/VideoSourceReader.js index 2e6e6b0f..f098fbda 100644 --- a/components/Video/VideoSourceReader.js +++ b/components/Video/VideoSourceReader.js @@ -30,7 +30,7 @@ function getYouTubeEmbedUrl(id, playerParams) { } function getVimeoEmbedUrl(id) { - return `https://player.vimeo.com/video/${id}?title=0&byline=0&portrait=0&playsinline=0`; + return `https://player.vimeo.com/video/${id}?title=0&byline=0&portrait=0`; } /** diff --git a/package.json b/package.json index bf373d4f..4d0d69f2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@shoutem/ui", - "version": "4.0.16", + "version": "4.0.17", "description": "Styleable set of components for React Native applications", "dependencies": { "@shoutem/animation": "~0.12.4",