Skip to content

Commit

Permalink
Merge pull request #559 from shoutem/release/4.0.17
Browse files Browse the repository at this point in the history
Release/4.0.17
  • Loading branch information
tomislav-arambasic authored Dec 14, 2020
2 parents d93dc4e + 19f51e1 commit c6c59fd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
22 changes: 16 additions & 6 deletions components/Video/Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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 (
<View style={style.container}>
<WebView
allowsFullscreenVideo
allowsFullscreenVideo={isYoutubeVideo}
mediaPlaybackRequiresUserAction={false}
style={{width, height}}
source={createSourceObject(source, playerParams, poster)}
source={getSource(this.sourceReader, poster)}
scrollEnabled={false}
originWhitelist={['*']}
/>
Expand Down
2 changes: 1 addition & 1 deletion components/Video/VideoSourceReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit c6c59fd

Please sign in to comment.