Can't not render .MP4 on Cobalt (on browser works)

114 views
Skip to first unread message

Stefan Predolac

unread,
Apr 16, 2024, 3:29:18 AM4/16/24
to cobalt-dev
Hi,
I installed Cobalt on android Set Top Bo (STB) device.

I succesfully run my simple/test HTML page on Cobalt (started local web server in Python/Flask on my machine) with adb terminal.

This is how my index.html look:

<body style="background-color: rgb(86, 205, 215);">
<h1>Test app</h1>
<video width="400" src="../static/videos/bbb_sunflower_1080p_30fps_stereo_arcc.mp4" type="video/mp4"
controls></video>
</body>


On Cobalt only h1 tag is rendered:

Screenshot from 2024-04-16 09-21-22.png



On devTool video element is actually rendered:

Screenshot from 2024-04-16 09-24-40.png




On Browser:

Screenshot from 2024-04-16 09-26-15.png


Thank you in advance,
Any help will be appreciated.
My future in the company depends on this task :D

Stefan


dominic...@broadcom.com

unread,
Apr 16, 2024, 12:04:24 PM4/16/24
to cobalt-dev
Hello Stefan,

I had the same surprise when trying to test simple videos with Cobalt. Unfortunately, I believe Cobalt does not implement the "src" attribute, video only works by injecting buffers via javascript MediaSource (and your mp4 needs to be a special format too).

Cobalt team: can you check if this example is still working? It is the simplest one I found, but I can't get it to play.

Cheers,
Dominic
 

Xiaoming Shi

unread,
Apr 16, 2024, 1:27:56 PM4/16/24
to cobalt-dev
Have you tried https://github.com/youtube/cobalt/tree/main/cobalt/demos/content/dual-playback-demo, with one of the video elements removed so it only plays one video?

dominic...@broadcom.com

unread,
Apr 16, 2024, 1:48:25 PM4/16/24
to cobalt-dev
One more gotcha (getting the examples to work on browser): some javascript in the examples require https
eme-demo.js:43 Uncaught TypeError: navigator.requestMediaKeySystemAccess is not a function
    at eme-demo.js:43:11

And even then you'll probably hit this on Chrome 
eme-demo.js:98 Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD

Then you can try to interact with the white page, reload a bunch of times, eventually you'll get a black video rectangle, right-click and enable show controls, then click play, then finally the video will play.

Cobalt team: any easier method?

dominic...@broadcom.com

unread,
Apr 16, 2024, 6:15:29 PM4/16/24
to cobalt-dev
I remember now. For cross-browser support, use the shaka player (like YTS does).

Stefan Predolac

unread,
Apr 17, 2024, 4:55:34 AM4/17/24
to cobalt-dev
Hi Dominic,

Thank you for your answer.

I succeeded to run stream on Cobalt by dynamically adding "src" to video element. But for some reason I cannot play streams from project folder, only from google storage.

BR,
Stefan
Message has been deleted

Xiaoming Shi

unread,
Apr 24, 2024, 5:09:42 PM4/24/24
to cobalt-dev
Cobalt only supports loading mp4 files on the network.  We do have a FileDataSource implementation to load local mp4 files.  The implementation is not of production quality and is only used in sandboxes.
Reply all
Reply to author
Forward
0 new messages