# Can I embed YouTube in a WebOS app?

**URL:** <https://forum.webostv.developer.lge.com/t/can-i-embed-youtube-in-a-webos-app/2295>\
**Category:** Web App Development\
**Created:** [March 7, 2023, 6:50pm UTC](https://forum.webostv.developer.lge.com/t/can-i-embed-youtube-in-a-webos-app/2295 "2023-03-07T18:50:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lizozom](https://avatars.discourse-cdn.com/v4/letter/l/ecccb3/32.png) [@lizozom](https://forum.webostv.developer.lge.com/u/lizozom)\
**Post date:** [March 7, 2023, 6:50pm UTC](https://forum.webostv.developer.lge.com/t/can-i-embed-youtube-in-a-webos-app/2295/1 "2023-03-07T18:50:05Z")

</div>

I have a web application in which I embed a youtube video.

```auto
<object width="1152" height="648">
    <param name="allowFullScreen" value="true">
    <param name="allowscriptaccess" value="always">
    <param name="movie" value="https://www.youtube.com/embed/HOsOTaXUg7c">
    <embed src="https://www.youtube.com/embed/HOsOTaXUg7c" width="100%" height="100%">
</object>

```

This code works perfectly in the browser, however on the WebOS simulator, the same code results in a `Video Unavailable`:

 ![Screenshot from 2023-03-07 20-37-11](https://canada1.discourse-cdn.com/flex030/uploads/webostv/original/1X/3d9cd4cc0fd6f03c997a4782e0bad95728715fae.png)

How to I make this video work on a WebOS TV?

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [March 7, 2023, 11:59pm UTC](https://forum.webostv.developer.lge.com/t/can-i-embed-youtube-in-a-webos-app/2295/2 "2023-03-07T23:59:02Z")

</div>

Opening `https://www.youtube.com/embed/HOsOTaXUg7c` in PC Chrome browser shows the same error. Please try another video. Thank you.

---

<div class="post-metadata">

**Author:** ![lizozom](https://avatars.discourse-cdn.com/v4/letter/l/ecccb3/32.png) [@lizozom](https://forum.webostv.developer.lge.com/u/lizozom)\
**Post date:** [March 8, 2023, 9:06am UTC](https://forum.webostv.developer.lge.com/t/can-i-embed-youtube-in-a-webos-app/2295/3 "2023-03-08T09:06:14Z")

</div>

This video URL type is mean for embedding, in accordance with YouTube’s embedding instructions. So you have to open it using an object or an iframe, like I showed in my code snippet.

You can see it working in this [JSFiddle](https://jsfiddle.net/lizozomi/Lg9pv0ce/1/).

In the meanwhile, I tested it on my TV, and it doesn’t work there as well. Any idea why?

---

<div class="post-metadata">

**Author:** ![lizozom](https://avatars.discourse-cdn.com/v4/letter/l/ecccb3/32.png) [@lizozom](https://forum.webostv.developer.lge.com/u/lizozom)\
**Post date:** [March 9, 2023, 11:31am UTC](https://forum.webostv.developer.lge.com/t/can-i-embed-youtube-in-a-webos-app/2295/4 "2023-03-09T11:31:41Z")

</div>

For anyone else experiencing this, this happens because YouTube won’t allow embedding videos in a page with a `file://` protocol, which is the case for a `basic` WebOS app.

Some possible solutions are:

1. use a `hosted app`
2. use a proxy `iframe` to load the video. I created a basic example [here](https://youtube-test.tiiny.site/?videoId=QwXHcgZUnFI) and it allows you to pass in a video ID and load it from any page.

---

<div class="post-metadata">

**Author:** ![user1885](https://avatars.discourse-cdn.com/v4/letter/u/9e8a1a/32.png) [@user1885](https://forum.webostv.developer.lge.com/u/user1885)\
**Post date:** [June 12, 2023, 11:22pm UTC](https://forum.webostv.developer.lge.com/t/can-i-embed-youtube-in-a-webos-app/2295/5 "2023-06-12T23:22:15Z")

</div>

There are multiple factors contributing to this problem. Some possible reasons for encountering such errors include:

- There is a possibility that the video violates [YouTube](https://net-informations.com/q/mis/youtube.html) policy.
- The cache got corrupted and needs to be cleared.
- There may be a reason for the poor quality of the video.
- There may be an issue with the internet speed.

You can try out some options to avoid such situations of non-availability of your favorite videos. A few recommended options include:

- Try to reinstall your web browser.
- You can try a different browser to play the desired youtube video.
- Enable Flash and JavaScript.
- Deleting Cookies
- Update GPU drivers

Remember to always ensure that you are compliant with YouTube’s terms of service and copyright policies when accessing and sharing videos.
