YouTube Video cannot be embedded

I have a 23 min. video I want to add to my first Xway website, inserting iframe. (longtime Freeway user) It is set to public in YouTube and I used the YT URL from the browser. No matter what I try, it says “This YouTube Video cannot be embedded”. I realize I could added it as a Resource, except for the size - it is large even after compressing - 968.6 MB. What to do?
Thank you in advance for any advice.

When you say it says “This YouTube Video cannot be embedded”, are you seeing the iframe on your page with those words inside it? Are you trying this locally on your Mac, or are you testing it on a server? If on a server, does it have SSL (https:// in the URL)?

There are a lot of ways that this could happen, and these are just a few possible avenues to explore. The more you explain what’s happening, the better we can help you.

Also, the size is not important in this context. These videos are streamed, not downloaded, in order to play. Only enough of the file to pre-buffer is on your computer at any given time.

Walter

Walter - thank you for that. And I just discovered my first problem. Apparently when I made the video public on YouTube I forgot to save my changes. Silly me.

are you seeing the iframe on your page with those words inside it?

Yes - but that is now resolved since the video is now saved as public on YT

Are you trying this locally on your Mac, or are you testing it on a server?

Locally on my Mac -
Got this message inside a black box when I preview in browser:
“An error occurred.
Unable to execute JavaScript.”
And you’re right - it doesn’t have http:// in the URL - so I realize I need to publish on the server for things to work.

Thanks so much and I will report back. :slight_smile:

HI again,

Still working through a few things. It appeared at first that the YouTube video was set to go, but when published on the server I get an error. “Unable to execute Javascript.” It is the same no matter which browser or computer, or iPhone I use. I even added a SSL cert. to the site, but nothing changed. Any ideas on how to fix this?
Thank you, Laura

Do you have a URL where I could look at this?

Walter

Hi Saskia,

Something I would do in this situation is to enable the Develop menu in Safari, and look for any errors that are reported when you choose View Page Source from the Develop menu.

Alternatively, if the error is being reported in the box that should contain the YouTube video, check that you have entered the YouTube URL correctly. Does the video show up in Xway (or Safari) when you preview locally?

If you share the address of your website, I (or someone else) could have a look at it.

Actually, YouTube videos should display in Xway’s Page and Web views. You don’t need to publish them on a server first. I wonder what you’re using as the iframe URL: what text is in the URL field in the Box section of the Box Inspector when the iframe is selected in Xway?

An easy way to get the correct URL: control (or right) click on the video in YouTube and choose “Copy Link”. Then paste this into the URL box in Xway.

Here 'tis.: agingerbreadlife.com

Something I would do in this situation is to enable the Develop menu in Safari , and look for any errors that are reported when you choose View Page Source from the Develop menu.

Screen shots if what I see in the page source in Safari
Screenshot 2023-09-19 at 5.34.18 PM

An easy way to get the correct URL: control (or right) click on the video in YouTube and choose “Copy Link”. Then paste this into the URL box in Xway.

Copying the link didn’t work : a plain white box read " this video cannot be embedded"

Then I went to Share and copied the “embed” code and got the black box that reads “unable to execute JavaScript”

But when I paste it in the iframe URL it doesn’t show all the code. This is what it fills in:

Well you can’t see what I pasted…

But this is all the embed code I copied:

Apparently, this forum doesn’t allow the code to show in the message…

Maybe you can see something when you go to the website URL. agingerbreadlife.com
Thanks,
Saskia aka Laura

Xway displays this message when the video cannot be embedded. You can fix this on YouTube if it’s your video. If it’s not your video, the person who uploaded it may have deliberately chosen to prevent the video from being embedded.

Can you share a link for the YouTube video that you are trying to embed?

And it is my video

If you click on that link in this forum, you should see the following message: “Video unavailable. Playback on other websites has been disabled by the video owner”.

Since you are the owner, you should be able to enable playback on other websites (in your YouTube settings for this video).

Here are some instructions for doing that:

  1. Visit your Video Manager.
  2. Find the video you’d like to change and click Edit.
  3. Click Advanced Settings under the video.
  4. Check the Allow Embedding checkbox under the “Distribution Options” section.
  5. Click Save changes at the bottom of the page.

I bet you can change this if you look around in YouTube.

Walter

The “embed code” is HTML code that can be used on hand-coded sites. Xway might try to extract the URL within this code, but what you should really do is copy and paste the link. I can understand why you might have thought this would help to get around the “cannot be embedded” error, but it doesn’t do that.

I have done both multiple times Right now using the simple link. I edited the YT video to allow embedding - every which way I could find to allow embedding. Saved. Doesn’t make any difference. Still says this Youtube video cannot be embedded. I will close out of everything and start fresh.
Thank you both for all your help. I will report back.

I think I need to step away and start fresh.

It looks like you’ve fixed it on YouTube: your video now plays within Discourse if I click on the link you shared above.

So all you need to do now is to copy that link and paste it into the iframe URL field in Xway. It works for me if I do that: Xway’s Page view displays a preview of the video (instead of the “This video cannot be embedded” message), and Xway’s Web view allows you to play the video.

If you want something to appear exactly as you enter it, rather than being interpreted e.g. taking a YouTube URL and turning it into an embedded video, you can use the preformatted button at the top of the editor:
image

Or type ``` on the lines before and after the text.


The problem you’re seeing is related to iframe sandboxing settings. If you select the iframe box in Xway and look in the box inspector, you’ll see sandbox is enabled and everything inside that is disabled.

While sandbox is enabled, Allow Scripts and Allow Same Origin will also need to be enabled for YouTube videos to work correctly. Iframe sandbox is off by default but presumably it was turned on when you created the iframe or later when trying to resolve a different problem.

That did it! Yay! Works perfectly. Thank you Simon and everyone so much - I have learned lots! :smile:

Sandbox is turned off by default in Xway. Perhaps you turned it on when you were looking for ways to fix the original problem.

We should probably change our “This video cannot be embedded” message to make it clearer that this is something that has to be fixed on YouTube. The message that YouTube displays is clearer: “Video unavailable. Playback on other websites has been disabled by the video owner.”

1 Like

That sounds like a great idea - gives a clue to the problem… Thanks again.