Skip to content

Commit a902c66

Browse files
committed
update doc
1 parent ea27342 commit a902c66

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

doc/readme.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
- [initialPlayerParams](#initialPlayerParams)
4646
- [webViewStyle](#webViewStyle)
4747
- [webViewProps](#webViewProps)
48+
- [forceAndroidAutoplay](#forceAndroidAutoplay)
4849

4950
### Ref functions
5051

@@ -126,21 +127,15 @@ Starts the playlist from the given index
126127
**_Boolean_**
127128

128129
Flag to tell the player to play or pause the video.
130+
129131
Make sure you match this flag `onChangeState` to handle user pausing
130132
the video from the youtube player UI
131133

132134
> **note on autoPlay**: The HTML5 `<video>` element, in certain mobile browsers (such as Chrome and Safari), only allows playback to take place if it's initiated by a user interaction (such as tapping on the player).
133135
134136
A work around to get the video to autoplay is to add these parameters to alter the user agent of the webview.
135-
Add the following code to the component to make autoplay for on android. (ios seems to work out of the box)
136137

137-
```JSX
138-
webViewProps={{
139-
userAgent:
140-
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
141-
mediaPlaybackRequiresUserAction: false,
142-
}}
143-
```
138+
use the [forceAndroidAutoplay](#forceAndroidAutoplay) prop if auto play is not working. (usually is affected by older android devices)
144139

145140
## onChangeState
146141

@@ -251,6 +246,12 @@ A style prop that will be given to the webview
251246

252247
Props that are supplied to the underlying webview (react-native-webview). A full list of props can be found [here](https://github.com/react-native-community/react-native-webview/blob/master/docs/Reference.md#props-index)
253248

249+
## forceAndroidAutoplay
250+
251+
Changes user string to make autoplay work on the iframe player for some android devices.
252+
253+
userAgent string - `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36';`
254+
254255
# Ref functions
255256

256257
usage -

0 commit comments

Comments
 (0)