Load stream player dynamically

Is there a way to initialize a stream after page load. If by example i create the stream tag by javascript dynamically?

eg. using jquery :

$(‘<stream id=“streamId” src=“5d5bc37ffcf54c9b82e996823bffbb81”’).appenTo(‘body’);
$(‘streamId’).initStream(); ← does something like this exists ?

Do you recommend any other method?

Was also looking for something like this but couldn’t find it. Decided to use the Dash.js player instead, as it supports this (and more).

Thanks @elecdes, but how did you get the videos URL ?

The format of the URL to pass to Dash.js (eg MediaPlayer::initialize or ::attachSource) is as follows:
Where VIDEO_ID is the Cloudflare stream id (eg 5d5bc37ffcf54c9b82e996823bffbb81, which you can get from the ‘Get link’/‘Get embed code’ buttons on the Stream dashboard, or from the Stream API), or the signed token.

This is great @elecdes. Thanks a lot.

After creating new stream tag call window.__stream.init();