WKWebView loadHTMLString is not loading embedded Video in some circumstances

On the iOS 15 os version loadHTMLString are not able to load the embedded Video in the HTML script. I can't see any error logs in the console.

 let sourcepath = "https://www.youtube.com/watch?v=XSdGBXYe9og"
    let htmlString = "<p><iframe style=\"border:1px solid #999999\" src=\(sourcepath) width=\"400\" height=\"320\" allowfullscreen=\"allowfullscreen\"></iframe></p>"
    webView.loadHTMLString(htmlString, baseURL: nil)

I am using the above code snippet to load the HHTML content. It is working for youtube videos but it is not loading from some private domain. The same video, I am able to play on the iPad with the same code. The video is loading if I am using webView.load() API of WKwebView library or directly in safari browser in iPhone.

Do I miss something in loadHTMLString API? Please suggest the solution to fix the problem.

Thank you!

WKWebView loadHTMLString is not loading embedded Video in some circumstances
 
 
Q