@plusscommunities/pluss-core-app 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/MediaPlayer.js +13 -12
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@ class MediaPlayer extends Component {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
componentDidMount = async () => {
|
|
42
|
-
this.setupForPlaying();
|
|
42
|
+
await this.setupForPlaying();
|
|
43
43
|
|
|
44
44
|
ScreenOrientation.lockAsync(Platform.OS === 'ios' ? ScreenOrientation.OrientationLock.DEFAULT : ScreenOrientation.OrientationLock.ALL);
|
|
45
45
|
const motionAvailalble = await DeviceMotion.isAvailableAsync();
|
|
@@ -75,25 +75,26 @@ class MediaPlayer extends Component {
|
|
|
75
75
|
|
|
76
76
|
setupForPlaying = async () => {
|
|
77
77
|
// Extract live stream info
|
|
78
|
-
const { source } = this.props;
|
|
79
|
-
const isUrlLink = source.startsWith('http');
|
|
80
|
-
const isYoutube = source.includes('youtube.com/watch?v=') || source.includes('youtu.be/');
|
|
81
|
-
const isVimeo = source.includes('vimeo.com/');
|
|
82
|
-
|
|
78
|
+
const { source, useVideoPlayer } = this.props;
|
|
79
|
+
const isUrlLink = source && source.startsWith('http');
|
|
80
|
+
const isYoutube = source && (source.includes('youtube.com/watch?v=') || source.includes('youtu.be/'));
|
|
81
|
+
const isVimeo = source && source.includes('vimeo.com/');
|
|
82
|
+
let heightFactor = 0;
|
|
83
83
|
|
|
84
84
|
if (isYoutube) {
|
|
85
85
|
const metadata = await getYoutubeMeta(this.getYoutubeVideoId(source));
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.setState({ heightFactor: 0.565, readyToRender: true });
|
|
86
|
+
heightFactor = metadata.height / metadata.width;
|
|
87
|
+
} else if (useVideoPlayer) {
|
|
88
|
+
heightFactor = 0;
|
|
90
89
|
} else {
|
|
91
|
-
|
|
90
|
+
heightFactor = 0.565;
|
|
92
91
|
}
|
|
92
|
+
|
|
93
|
+
this.setState({ isUrlLink, isYoutube, isVimeo, playbackLoaded: isYoutube || isVimeo, heightFactor, readyToRender: true });
|
|
93
94
|
};
|
|
94
95
|
|
|
95
96
|
getStreamPlaybackUrl = () => {
|
|
96
|
-
// return 'https://stream.mux.com/
|
|
97
|
+
// return 'https://stream.mux.com/Ym4nKktRpGuZNBBBlzhxpyRwZLpvMlPRchcu01x6Ur600.m3u8';
|
|
97
98
|
return `https://stream.mux.com/${this.props.playbackId}.m3u8`;
|
|
98
99
|
};
|
|
99
100
|
|