@shoutem/ui 9.0.0 → 9.0.2-rc.0

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.
@@ -6,24 +6,27 @@ import { connectAnimation } from '@shoutem/animation';
6
6
  import { connectStyle } from '@shoutem/theme';
7
7
  import VideoSourceReader from './VideoSourceReader';
8
8
 
9
- function getSource(sourceReader, poster) {
9
+ function getSource(sourceReader, poster, headers) {
10
10
  const url = sourceReader.getUrl();
11
+ let source;
11
12
 
12
13
  if (sourceReader.isEmbeddableVideo()) {
13
- return {
14
- uri: url,
15
- };
14
+ source = { uri: url };
15
+ } else {
16
+ const HTML = `
17
+ <video width="100%" height="auto" poster="${poster}" controls >
18
+ <source src="${url}" >
19
+ </video>
20
+ `;
21
+
22
+ source = { html: HTML };
16
23
  }
17
24
 
18
- const HTML = `
19
- <video width="100%" height="auto" poster="${poster}" controls >
20
- <source src="${url}" >
21
- </video>
22
- `;
25
+ if (headers) {
26
+ source.headers = headers;
27
+ }
23
28
 
24
- return {
25
- html: HTML,
26
- };
29
+ return source;
27
30
  }
28
31
 
29
32
  /**
@@ -44,7 +47,8 @@ class Video extends PureComponent {
44
47
  }
45
48
 
46
49
  render() {
47
- const { width, height = '100%', style, poster } = this.props;
50
+ const { width, height = '100%', style, poster, headers } = this.props;
51
+ const webViewSource = getSource(this.sourceReader, poster, headers);
48
52
 
49
53
  return (
50
54
  <View style={style.container}>
@@ -52,7 +56,7 @@ class Video extends PureComponent {
52
56
  allowsFullscreenVideo
53
57
  mediaPlaybackRequiresUserAction={false}
54
58
  style={{ width, height }}
55
- source={getSource(this.sourceReader, poster)}
59
+ source={webViewSource}
56
60
  scrollEnabled={false}
57
61
  originWhitelist={['*']}
58
62
  />
@@ -63,6 +67,7 @@ class Video extends PureComponent {
63
67
 
64
68
  Video.propTypes = {
65
69
  style: PropTypes.object.isRequired,
70
+ headers: PropTypes.object,
66
71
  height: PropTypes.number,
67
72
  // `playerParams` currently only works for Youtube
68
73
  playerParams: PropTypes.object,
@@ -75,6 +80,7 @@ Video.propTypes = {
75
80
 
76
81
  Video.defaultProps = {
77
82
  width: undefined,
83
+ headers: undefined,
78
84
  height: undefined,
79
85
  playerParams: { showinfo: 0 },
80
86
  source: undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shoutem/ui",
3
- "version": "9.0.0",
3
+ "version": "9.0.2-rc.0",
4
4
  "description": "Styleable set of components for React Native applications",
5
5
  "scripts": {
6
6
  "lint": "eslint .",
@@ -17,7 +17,7 @@
17
17
  "@react-native-community/datetimepicker": "6.2.0",
18
18
  "@shoutem/animation": "1.0.0",
19
19
  "@shoutem/eslint-config-react": "~1.0.6",
20
- "@shoutem/theme": "1.0.0",
20
+ "@shoutem/theme": "1.0.1",
21
21
  "auto-bind": "4.0.0",
22
22
  "babel-plugin-transform-decorators-legacy": "1.3.5",
23
23
  "buffer": "5.6.0",