@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-core-app",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Core extension package for Pluss Communities platform",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -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
- this.setState({ isUrlLink, isYoutube, isVimeo, playbackLoaded: isYoutube || isVimeo });
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
- this.setState({ heightFactor: metadata.height / metadata.width, readyToRender: true });
87
- // console.log('youtube metadata', metadata);
88
- } else if (isVimeo) {
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
- this.setState({ readyToRender: true });
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/nflNhyFQMlrSt00II01Hjh2BLSW009PH1tl023pdpJ01s1vc.m3u8';
97
+ // return 'https://stream.mux.com/Ym4nKktRpGuZNBBBlzhxpyRwZLpvMlPRchcu01x6Ur600.m3u8';
97
98
  return `https://stream.mux.com/${this.props.playbackId}.m3u8`;
98
99
  };
99
100