question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

View controls are not shown on Android

See original GitHub issue

More often than not, the youtube view on Android, loads with only the starting image (cover) of the video, but without any video player controls. Nor the play button, nor the fullscreen mode button, nothing.

As far as I’ve seen throughout the other issues, this type of behaviour is not reported so-far. Is there something I am missing, or not using the component as intended?

I am using the component in the following manner:

  render() {
    return (
      <YouTube
        videoId={SOME_VIDEO_ID} // The YouTube video ID
        play={false}                                               // control playback of video with true/false
        hidden={false}                                             // control visibility of the entire view
        playsInline={true}                                         // control whether the video should play inline
        loop={false}                                               // control whether the video should loop when ended

        //onReady={(e)=> console.log("onReady", e)}
        //onChangeState={(e)=> console.log("onChangeState", e)}
        //onChangeQuality={(e)=> console.log("onChangeQuality", e)}
        //onError={(e)=> console.log("onError", e)}
        //onProgress={(e)=> console.log("onProgress", e)}

        ref={component => this._root = component}
        style={{alignSelf: 'stretch', height: 250, backgroundColor: 'black'}}
        apiKey={YOUTUBE_API_KEY}
      />
    )
  }

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:20
  • Comments:49 (10 by maintainers)

github_iconTop GitHub Comments

59reactions
wack17scommented, Jul 11, 2017

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 }}
            />
        );
    }
}
35reactions
koswarabillycommented, Nov 30, 2017

use the hack above but set the timeout to 500, it works like charm for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Controls are not visible in the .xml file of android studio ,Inspite ...
First check for this dependency in your build.gradle(Module:app) implementation 'com.android.support.constraint:constraint-layout:1.1.2'.
Read more >
View - Android Developers
There are many specialized subclasses of views that act as controls or are capable of displaying text, images, or other content.
Read more >
Controls | Maps JavaScript API - Google Developers
The maps displayed through the Maps JavaScript API contain UI elements to allow user interaction with the map. These elements are known as...
Read more >
Control notifications on Android - Google Support
Touch and hold the app with the dot to see the oldest notification. Then, clear each to show the next. Learn about notification...
Read more >
Zoom Rooms meeting controls and settings
The room also does not receive notification that new participants have joined. You can see new participants as they join by displaying Gallery...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found