Center an embedded youtube video in a UIWebview Swift
<p>I have a webveiw with a youtube video i embedded.It work fine and all but the problem is I want it to be entered and be the size of the width of the web view. Right now it is to the left side and not expanded to the other size. The hight is fine but I want the width fixed. </p>

<p>where player is the uiview
Here is what I have so far:</p>

<pre><code>    let myVideo = "https://myvideo"

    let myHTML = "&lt;iframe width=\"\(player.frame.size.width)\" height=\"\(player.frame.size.height)\" src=\"\(myVideo)?&amp;playsinline=1\" frameborder=\"0\" allowfullscreen&gt;&lt;/iframe&gt;"


    player.allowsInlineMediaPlayback = true
    player.loadHTMLString(myHTML, baseURL: nil)
    player.frame = UIScreen.mainScreen().bounds


    player.backgroundColor = UIColor.clearColor()
    player.widthAnchor.constraintEqualToConstant(250)
</code></pre>

<p>Thanks for any help with this.</p>