Skip to content

Browsers on objects

Eva edited this page Jul 13, 2021 · 1 revision

Browsers also can be rendered as textures of objects.

To make it work you should use player objects (and also no streamer, because it changes object ids all the time).

Choose an object and its texture (here for example). In this case, I will use an old TV (14772) that has CJ_TV_SCREEN texture. The texture has 128x128 size, so let's pass the scale as 7 to make it 896x896.

new object = CreatePlayerObject(playerid, 14772, 2039.0, 1338.9792, 12.0, 0.0, 0.0, 0.0);
cef_create_ext_browser(playerid, 1, "CJ_TV_SCREEN", "https://www.youtube.com/embed/Gqa8_5bWzQQ?autoplay=1&controls=0", 7);

// it is also good to put it in OnCefBrowserCreated
cef_append_to_object(playerid, 1, object);

Now you can see something like this, but with another video.

These browsers are created for every player on their PC, which means there is no sync from the box. If you want to develop something like cinema you should use services that allows you to create rooms with synchronized videos. This can be done using twitch/youtube streams.

Clone this wiki locally