# Can the Bitmovin player API expose end of periods (DASH) or discontinuities (HLS)?

**URL:** <https://community.bitmovin.com/t/can-the-bitmovin-player-api-expose-end-of-periods-dash-or-discontinuities-hls/1617>\
**Category:** Support\
**Tags:** player-sdks\
**Created:** [January 9, 2023, 1:39pm UTC](https://community.bitmovin.com/t/can-the-bitmovin-player-api-expose-end-of-periods-dash-or-discontinuities-hls/1617 "2023-01-09T13:39:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabre.lambeau1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.bitmovin.com/fabre.lambeau1/32/519_2.png) [@fabre.lambeau1](https://community.bitmovin.com/u/fabre.lambeau1)\
**Post date:** [January 9, 2023, 1:39pm UTC](https://community.bitmovin.com/t/can-the-bitmovin-player-api-expose-end-of-periods-dash-or-discontinuities-hls/1617/1 "2023-01-09T13:39:35Z")

</div>

I would like to create a player to monitor VOD and live feed in which mid-roll ads are used (which are fulfilled through server-side ad insertion, not client-side!).  
Is it possible for the Web player’s SDK (in Chrome browser in particular) to trigger an event when a discontinuity takes place (in HLS) or a transition between periods (in DASH) takes place?

---

<div class="post-metadata">

**Author:** ![lucky.goyal](https://sea1.discourse-cdn.com/flex015/user_avatar/community.bitmovin.com/lucky.goyal/32/506_2.png) [@lucky.goyal](https://community.bitmovin.com/u/lucky.goyal)\
**Post date:** [January 9, 2023, 1:54pm UTC](https://community.bitmovin.com/t/can-the-bitmovin-player-api-expose-end-of-periods-dash-or-discontinuities-hls/1617/2 "2023-01-09T13:54:11Z")

</div>

Hi @fabre.lambeau1 , thanks for your question.

In general SSAI Ad insertion in HLS and DASH consists of following 2 potential signalizations.

- DASH period change and HLS playlist #EXT-X-DISCONTINUITY tag.
- Ad metadata in form of DASH event streams and HLS #EXT-X-SCTE35 or #EXT-X-DATERANGE or #EXT-X-CUE- tags.

Bitmovin Web SDK provides support for following.

- [PeriodSwitch](https://cdn.bitmovin.com/player/web/8/docs/enums/core_events.playerevent.html#periodswitch) marking start of DASH period switch.
- [PeriodSwitched](https://cdn.bitmovin.com/player/web/8/docs/enums/core_events.playerevent.html#periodswitched) marking period switch complete for DASH periods.
- [Metadata](https://cdn.bitmovin.com/player/web/8/docs/enums/core_events.playerevent.html#metadata) events for DASH event streams and HLS #EXT-X-SCTE35 or #EXT-X-DATERANGE or #EXT-X-CUE- tags. The event carries a [MetadataType](https://cdn.bitmovin.com/player/web/8/docs/enums/core_events.metadatatype.html) field which can be used identify what caused the metadata event and the metadata contained in event generally provide information about Ad.
- For HLS #EXT-X-DISCONTINUITY, there is no event fired by player but there is another potential way to find about discontinuities. Player SDK provides a [segmentplayback](https://cdn.bitmovin.com/player/web/8/docs/enums/core_events.playerevent.html#segmentplayback) event which contains [discontinuitySequenceNumber](https://cdn.bitmovin.com/player/web/8/docs/interfaces/core_events.segmentplaybackevent.html#discontinuitysequencenumber). If app registers for this event, then it can detect a discontinuity by monitoring a change in value of `discontinuitySequenceNumber`. Please note that app will need to enable [TweaksConfig.native\_hls\_parsing](https://cdn.bitmovin.com/player/web/8/docs/interfaces/core_config.tweaksconfig.html#native_hls_parsing) to use `SegmentPlaybackEvent` on platforms like Safari where native player is used.

Please let us know if above information helps or if there are any follow up questions.

Thanks and Regards,  
Lucky Goyal

---

<div class="post-metadata">

**Author:** ![fabre.lambeau1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.bitmovin.com/fabre.lambeau1/32/519_2.png) [@fabre.lambeau1](https://community.bitmovin.com/u/fabre.lambeau1)\
**Post date:** [January 9, 2023, 2:31pm UTC](https://community.bitmovin.com/t/can-the-bitmovin-player-api-expose-end-of-periods-dash-or-discontinuities-hls/1617/3 "2023-01-09T14:31:22Z")

</div>

Thanks @lucky.goyal,

So, for DASH that’s clear.  
For HLS (note that your 3rd bullet point mentions DASH instead of HLS), the EXT-X-DISCONTINUITY on its own would therefore not raise any event, it would need to be accompanied by one of the other EXT-X markers carrying metadata to work, is that right?

The idea here is to spot when there is a discontinuity / period change, independently of whether ads got filled. Particularly to help troubleshoot cases in which no ads where added even though there was an expectation that there would be one.

Cheers,

Fabre

---

<div class="post-metadata">

**Author:** ![lucky.goyal](https://sea1.discourse-cdn.com/flex015/user_avatar/community.bitmovin.com/lucky.goyal/32/506_2.png) [@lucky.goyal](https://community.bitmovin.com/u/lucky.goyal)\
**Post date:** [January 9, 2023, 3:12pm UTC](https://community.bitmovin.com/t/can-the-bitmovin-player-api-expose-end-of-periods-dash-or-discontinuities-hls/1617/4 "2023-01-09T15:12:01Z")

</div>

Thanks for sharing the use case. Your understanding is correct. There is no event for HLS #EXT-X-DISCONTINUITY but I have added a new point(4) in original answer(to keep entire answer in 1 reply) suggesting another potential way to achieve the desired use case. Also for point(3), [Metadata](https://cdn.bitmovin.com/player/web/8/docs/enums/core_events.playerevent.html#metadata) events work for both DASH (event streams) and HLS (playlist tags).

Thanks and Regards,  
Lucky Goyal

---

<div class="post-metadata">

**Author:** ![fabre.lambeau1](https://sea1.discourse-cdn.com/flex015/user_avatar/community.bitmovin.com/fabre.lambeau1/32/519_2.png) [@fabre.lambeau1](https://community.bitmovin.com/u/fabre.lambeau1)\
**Post date:** [January 9, 2023, 3:17pm UTC](https://community.bitmovin.com/t/can-the-bitmovin-player-api-expose-end-of-periods-dash-or-discontinuities-hls/1617/5 "2023-01-09T15:17:53Z")

</div>

Thanks @lucky.goyal. Brilliant, as always and as expected with you.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/bitmovin/original/1X/1ab86334145095b0af9c5b924fa3ae6d920b6482.png) [@system](https://community.bitmovin.com/u/system)\
**Post date:** [January 10, 2023, 2:04pm UTC](https://community.bitmovin.com/t/can-the-bitmovin-player-api-expose-end-of-periods-dash-or-discontinuities-hls/1617/6 "2023-01-10T14:04:20Z")

</div>

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