ads
How do I add the last part (stream-adstart)
Does anything else need to be done, or do I just put a tag and it works?
<!-- You can use styles and CSS on this iframe element where the video player will appear -->
<iframe
src="https://customer-/<CODE>.cloudflarestream.com/<VIDEO_UID>/iframe"
style="border: none"
height="720"
width="1280"
allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;"
allowfullscreen="true"
id="stream-player"
></iframe>
<script src="https://embed.cloudflarestream.com/embed/sdk.latest.js"></script>
<!-- Your JavaScript code below-->
<script>
const player = Stream(document.getElementById('stream-player'));
player.addEventListener('play', () => {
console.log('playing!');
});
player.play().catch(() => {
console.log('playback failed, muting to try again');
player.muted = true;
player.play();
});
</script>
Non-standard Events
Non-standard events are prefixed with stream- to distinguish them from standard events.
{{}}
stream-adstart
Fires when ad-url attribute is present and the ad begins playback
stream-adend
Fires when ad-url attribute is present and the ad finishes playback
stream-adtimeout
Fires when ad-url attribute is present and the ad took too long to load.
{{}}```
1 Reply
Do not spam multiple channels with your questions.