I have already tried to find a similar question here without success.
I have a UITableView with various contents and cells. In particular, it can display a custom UITableViewCell with WKWebView. Sometimes this webview has an autoplay video that starts when I set the cell to willDisplayCell . Since this autoplay function, when I scroll up / down, the cell does not call the didEndDisplayingCell delegate method , and the video remains active in the background. The user needs to close the viewController or the entire application.
I tried to save in the list all selected cells with webview and scrollViewDidEndDecelerating manually setting the contents of the saved cell web view to html "" using:
cell.webView?.loadHTMLString("", baseURL: nil)
Thus, web browsing stops correctly in order to play the video in the background, but the problem is that even with this approach, the cell does not queue and didEndDisplayingCell: is not called, so when I view this cell again, I cannot Repeat the correct configuration to reload the webview.
Do you have some tips or tricks?
source
share