Last active
April 6, 2023 15:41
-
-
Save paulofierro/a5598e1acf611fc24604 to your computer and use it in GitHub Desktop.
WKWebView video playback change notification
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Listen for video playback | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(videoPlayingDidChange:) | |
name:@"SomeClientPlayingDidChange" | |
object:nil]; | |
// Video playing state handler | |
- (void)videoPlayingDidChange:(NSNotification *)notification | |
{ | |
BOOL isPlaying = [notification.userInfo[@"IsPlaying"] boolValue]; | |
// Do stuff with this newfound knowledge | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So how would one go about playing an embedded video like YouTube in their WKWebView? When launching an embedded YouTube video from a UIWebView, it plays just fine – whereas in the WKWebView it automatically plays in fullscreen.