I
I
inocoder2018-08-13 10:55:35
iOS
inocoder, 2018-08-13 10:55:35

How to change information in remote command center in WKWebView?

I have a swift application in which the html page is displayed using wkwebview.
After pressing the play button, the audio stream plays.
I need the title and the picture to be shown in the control panel and lockscreen when playing in the control panel and the picture that I specify manually
How can I implement this, please tell me
Code

import WebKit
import UIKit
import MediaPlayer

class ViewController: UIViewController {

    @IBOutlet weak var myWebView: WKWebView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        
        myWebView.allowsBackForwardNavigationGestures = true
        
        let webUrl = URL(string: "https://dachafm.kz/mobile.html")
        
        var urlRequest = URLRequest(url: webUrl!)
        urlRequest.cachePolicy = .returnCacheDataElseLoad
        myWebView.load(urlRequest)
        
        myWebView.scrollView.bounces = false
        myWebView.scrollView.bouncesZoom = false
        myWebView.configuration.allowsInlineMediaPlayback = true
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question