Skip to content

Instantly share code, notes, and snippets.

@paulofierro
Last active April 6, 2023 15:41
Show Gist options
  • Save paulofierro/a5598e1acf611fc24604 to your computer and use it in GitHub Desktop.
Save paulofierro/a5598e1acf611fc24604 to your computer and use it in GitHub Desktop.
WKWebView video playback change notification
// 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
}
@revblaze
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment