How to use the react-native-youtube.YouTubeStandaloneIOS.playVideo function in react-native-youtube

To help you get started, we’ve selected a few react-native-youtube examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inProgress-team / react-native-youtube / example / ReactNativeYouTubeExample.js View on Github external
onPress={() => {
                YouTubeStandaloneIOS.playVideo('KVZ-P-ZI6W4')
                  .then(message => {
                    console.log(message);
                  })
                  .catch(errorMessage => {
                    this.setState({ error: errorMessage });
                  });
              }}
            />
github mattermost / mattermost-mobile / app / components / post_body_additional_content / post_body_additional_content.js View on Github external
playYouTubeVideo = () => {
        const {link} = this.props;
        const videoId = getYouTubeVideoId(link);
        const startTime = this.getYouTubeTime(link);

        if (Platform.OS === 'ios') {
            YouTubeStandaloneIOS.
                playVideo(videoId, startTime).
                then(this.playYouTubeVideoEnded).
                catch(this.playYouTubeVideoError);
        } else {
            const {googleDeveloperKey} = this.props;

            if (googleDeveloperKey) {
                YouTubeStandaloneAndroid.playVideo({
                    apiKey: googleDeveloperKey,
                    videoId,
                    autoplay: true,
                    startTime,
                }).catch(this.playYouTubeVideoError);
            } else {
                Linking.openURL(link);
            }