When playing the video in the Web interface, switch the interface and still hear the sound. Of course, the immediate solution is to intertune with the H5 when the interface disappears. This complicated approach becomes even more troublesome when many videos are involved in the interface.

Solutions:

Swift version
override func viewDidDisappear(_ animated: Bool) 
{
    super.viewDidDisappear(animated) 
    webView.load(URLRequest(url: URL(string: "about:blank")!))
}
Copy the code
OC version Original document Links to the OC version
- (void)viewDidDisappear:(BOOL)animated {NSLog(@" media open window stop "); [webViewer loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; }Copy the code