Play youtube's videos in a web mobile project

Hi, i’m working on a project which require to play youtube’s videos in the project, which is a web mobile project, is there any way to do that?

you can build a web mobile project.

Hi, linrm, i’m a web mobile project, but i’m not sure how to do it, which component or script i should use?

you can refer to :Publish to Web Platforms · Cocos Creator
No need to use component or script.

my project is a web mobile project, and i need to show a youtube’s video somewhere in project, this is my request

Direct show youtube’s video is not supported, you can show a local mp4 video , or remote mp4 video.

If you are doing a mobile web deployment, you could create a separate div/iframe for showing the youtube video

I am not sure I understood your requirements correctly. But, at least, let me try.

  • add a WebView component
  • load the YouTube link

When you build for a web project, the WebView component will become an iframe. So, make sure your video can be loaded via an iframe/cross domain.

Yes, i did something similar to fix this.
I builded a folder under the project with a html file.


The html file looks like this:

And when i need it i set the webview url to the path of this html

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.