capturing self strongly in this block is likely to lead to a retain cycle

The capture of self here is coming in with your implicit property access of self.timerDisp – you can’t refer to self or properties on self from within a block that will be strongly retained by self. You can get around this by creating a weak reference to self before accessing timerDisp inside your block: __weak … Read more

Looping a video with AVFoundation AVPlayer?

You can get a Notification when the player ends. Check AVPlayerItemDidPlayToEndTimeNotification When setting up the player: ObjC avPlayer.actionAtItemEnd = AVPlayerActionAtItemEndNone; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerItemDidReachEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:[avPlayer currentItem]]; this will prevent the player to pause at the end. in the notification: – (void)playerItemDidReachEnd:(NSNotification *)notification { AVPlayerItem *p = [notification object]; [p seekToTime:kCMTimeZero]; } this will rewind … Read more

How to detect AVplayer and get url of current video from WKWebView?

This is kind of a hack, but the only way I found to accomplish this. First set yourself as WKWebView navigation delegate: self.webView?.navigationDelegate = self Now listen to all navigation changes, and save the requested url: func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { if let urlStr = navigationAction.request.url?.absoluteString { … Read more