'"An error has occurred. Please try again later" in my iframe

I copy and paste a YouTube link inside my iframe tag and I got the following message when I play the video

"An error has occurred. Please try again later".

I put the embed within inside the link.

Here's my code:

<iframe width="450" height="200"
    src="https://www.youtube.com/embed?v=xZs6nCUQuuM">
</iframe>


Solution 1:[1]

I just found out that you could just go to the desired Youtube video, click share, click embed and then copy paste it to your code then viola. It's perfectly in my page, just needed some width and height styling to get the desired size. Anyways thank y'all for putting effort and time for answering my question, I really appreciated it.

Solution 2:[2]

Try this:

<iframe width="450" height="200"
    src="https://www.youtube.com/embed/xZs6nCUQuuM">
</iframe>

Solution 3:[3]

Add this to your info plist

<key>NSAppTransportSecurity</key>
<dict>
    <!--Not a recommended way, there are better solutions available-->
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rookie MJ
Solution 2 Oleg Rylin
Solution 3 mohammad alabid