React-native-youtube: Listening to onFullScreenExit event

Created on 27 Jan 2016  路  10Comments  路  Source: davidohayon669/react-native-youtube

I want to exit youtube player whenever full screen is exited. However, for that I need to listen to onFullScreenExit event. Is there any way I could do it?

help wanted

Most helpful comment

@teameh there is an onChangeFullscreen event now

All 10 comments

No it's not possible yet.

PR are welcome ;)

@gauravsapiens any workaround solution for this?

I think something like this could work iOS http://stackoverflow.com/questions/25766365/detect-when-a-webview-video-becomes-fullscreen-on-ios8/34706156#34706156 but needs to be implemented in the lib..

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(VideoExitFullScreen:)
                                                 name:UIWindowDidBecomeVisibleNotification
                                               object:self.view.window];

[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(VideoEnterFullScreen:)
                                                 name:UIWindowDidBecomeHiddenNotification
                                               object:self.view.window];

Forked and tried something like @tiemevanveen mentioned, seems to work (only for iOS).

Unfortunately I have too little time (and familiarity with Android) to tackle this in a PR atm, but perhaps it can help someone looking for the same.

Awesome! @mrwest808 yeah same here. A PR just for only iOS is not an option?

@tiemevanveen Yeah I suppose iOS only is better than nothing! 馃憤

I've implemented this for android in pull request #91. On android it then emits "fullscreenMode" and "windowMode" states in the onStateChange callback

@davidohayon669 what's the reason this is closed? It's implemented or just that the PR was not active for a while?

@teameh there is an onChangeFullscreen event now

Awesome! Thanks a lot! 馃憤

Was this page helpful?
0 / 5 - 0 ratings