Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

player don't show controls #187

Closed
ishita-kothari opened this issue Jul 10, 2017 · 5 comments
Closed

player don't show controls #187

ishita-kothari opened this issue Jul 10, 2017 · 5 comments

Comments

@ishita-kothari
Copy link

Hello,

I have update your package to "react-native-youtube": "^1.0.0-alpha.6". I am able to play the video at times but few times controls are not shown on android device and hence unable to play video. Also when I build my app, I am not able to play video. Controls are not displayed in released app.

code is:

<YouTube
ref={(component) => {
this._youTubeRef = component;
}}

                apiKey="api-key"
                videoId="video-id"
                play={this.state.isPlaying}
                loop={this.state.isLooping}
                fullscreen={this.state.fullscreen}
                controls={1}
                style={styles.player}
                onError={e => console.log( e.error)}
                onReady={e => this.setState({ isReady: true })}
                onChangeState={e => this.setState({ status: e.state })}
                onChangeQuality={e => this.setState({ quality: e.quality })}
                onChangeFullscreen={e => this.setState({ fullscreen: e.isFullscreen })}
                onProgress={Platform.OS === 'ios'
        ? e => this.setState({ duration: e.duration, currentTime: e.currentTime })
        : undefined}
            />
        </ScrollView>

on each button click a new video will open on new page.

Please guide me.

Thanks!

@davidohayon669
Copy link
Owner

#131

@ishita-kothari
Copy link
Author

I am still not able to run the video with controls. Can anyone give me proper solution?

@davidohayon669
Copy link
Owner

davidohayon669 commented Jul 11, 2017

@ishita-kothari there is a reason #131 is labeled with "bug"

@wack17s
Copy link

wack17s commented Jul 11, 2017

@ishita-kothari
this hack works for me

export default class extends Component {
    state = {
        height: 215
    }

    handleReady = () => {
        setTimeout(() => this.setState({ height: 216 }), 200);
    }

    render() {
        return (
            <YouTube
                apiKey   = {config.YOUTUBE_API_KEY}
                ref      = {item => this.player = item}
                videoId  = {getVideoId(uri)}
                controls = {1}
                onReady  = {this.handleReady}
                style    = {{ alignSelf: 'stretch', height: height }}
            />
        );
    }
}

@ishita-kothari
Copy link
Author

@wack17s thank you. Seems this hack worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants