dash.js
Open Source Media Player
Seamless and reliable DASH streaming on any browser-based device
View onGitHub
5496
1729
425.8k
Sponsors
Trusted by the industry leaders
Latest updates from GitHub
Conflict with subtitles in configurationWorking config, no conflicts
```
<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:webm:dash:profile:webm-on-demand:2012"
xmlns:xlink="http://www.w3.org/1999/xlink"
xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
profiles="urn:webm:dash:profile:webm-on-demand:2012"
type="static"
mediaPresentationDuration="PT2M11.0S"
maxSegmentDuration="PT3.0S"
minBufferTime="PT1.9S">
<Period id="0" start="PT0.0S">
<AdaptationSet id="0" contentType="video" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true" frameRate="29/1" maxWidth="2025" maxHeight="1080" par="15:8">
<SegmentTemplate timescale="1000000" initialization="init-$RepresentationID$.webm" media="sg-$RepresentationID$-$Number%05d$.webm" startNumber="1" duration="3000000" />
<Representation id="1" mimeType="video/webm" codecs="vp09.00.11.08" bandwidth="37011" width="270" height="144" sar="1:1" />
<Representation id="2" mimeType="video/webm" codecs="vp09.00.20.08" bandwidth="84265" width="450" height="240" sar="1:1" />
<Representation id="3" mimeType="video/webm" codecs="vp09.00.21.08" bandwidth="166918" width="675" height="360" sar="1:1" />
<Representation id="4" mimeType="video/webm" codecs="vp09.00.30.08" bandwidth="275871" width="900" height="480" sar="1:1" />
<Representation id="5" mimeType="video/webm" codecs="vp09.00.31.08" bandwidth="605080" width="1350" height="720" sar="1:1" />
<Representation id="6" mimeType="video/webm" codecs="vp09.00.40.08" bandwidth="1225045" width="2025" height="1080" sar="1:1" />
</AdaptationSet>
<AdaptationSet id="1" contentType="audio" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true">
<SegmentTemplate timescale="1000000" initialization="init-$RepresentationID$.webm" media="sg-$RepresentationID$-$Number%05d$.webm" startNumber="1" duration="3000000" />
<Representation id="0" mimeType="audio/webm" codecs="opus" bandwidth="160000" audioSamplingRate="48000">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
</Representation>
</AdaptationSet>
<AdaptationSet id="2" contentType="image" mimeType="image/webp">
<SegmentTemplate media="tile_$RepresentationID$_$Number%01d$.webp" duration="65.5" startNumber="1" />
<Representation id="150" bandwidth="1000" height="750" width="2810"><EssentialProperty schemeIdUri="http://dashif.org/thumbnail_tile" value="10x5" /></Representation>
<Representation id="250" bandwidth="3500" height="1250" width="4690"><EssentialProperty schemeIdUri="http://dashif.org/thumbnail_tile" value="10x5" /></Representation>
<Representation id="480" bandwidth="10000" height="2400" width="9000"><EssentialProperty schemeIdUri="http://dashif.org/thumbnail_tile" value="10x5" /></Representation>
</AdaptationSet>
</Period>
</MPD>
```
Subtitles need to be added
```
<AdaptationSet id="2" mimeType="text/vtt" lang="en">
<Representation id="0" bandwidth="256"><BaseURL>subtitles.vtt</BaseURL></Representation> </AdaptationSet>
```
Configuration with subtitles
```
<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:webm:dash:profile:webm-on-demand:2012"
xmlns:xlink="http://www.w3.org/1999/xlink"
xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
profiles="urn:webm:dash:profile:webm-on-demand:2012"
type="static"
mediaPresentationDuration="PT2M11.0S"
maxSegmentDuration="PT3.0S"
minBufferTime="PT1.9S">
<Period id="0" start="PT0.0S">
<AdaptationSet id="0" contentType="video" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true" frameRate="29/1" maxWidth="2025" maxHeight="1080" par="15:8">
<SegmentTemplate timescale="1000000" initialization="init-$RepresentationID$.webm" media="sg-$RepresentationID$-$Number%05d$.webm" startNumber="1" duration="3000000" />
<Representation id="1" mimeType="video/webm" codecs="vp09.00.11.08" bandwidth="37011" width="270" height="144" sar="1:1" />
<Representation id="2" mimeType="video/webm" codecs="vp09.00.20.08" bandwidth="84265" width="450" height="240" sar="1:1" />
<Representation id="3" mimeType="video/webm" codecs="vp09.00.21.08" bandwidth="166918" width="675" height="360" sar="1:1" />
<Representation id="4" mimeType="video/webm" codecs="vp09.00.30.08" bandwidth="275871" width="900" height="480" sar="1:1" />
<Representation id="5" mimeType="video/webm" codecs="vp09.00.31.08" bandwidth="605080" width="1350" height="720" sar="1:1" />
<Representation id="6" mimeType="video/webm" codecs="vp09.00.40.08" bandwidth="1225045" width="2025" height="1080" sar="1:1" />
</AdaptationSet>
<AdaptationSet id="1" contentType="audio" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true">
<SegmentTemplate timescale="1000000" initialization="init-$RepresentationID$.webm" media="sg-$RepresentationID$-$Number%05d$.webm" startNumber="1" duration="3000000" />
<Representation id="0" mimeType="audio/webm" codecs="opus" bandwidth="160000" audioSamplingRate="48000">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
</Representation>
</AdaptationSet>
<AdaptationSet id="2" mimeType="text/vtt" lang="en">
<Representation id="0" bandwidth="256"><BaseURL>subtitles.vtt</BaseURL></Representation>
</AdaptationSet>
<AdaptationSet id="3" contentType="image" mimeType="image/webp">
<SegmentTemplate media="tile_$RepresentationID$_$Number%01d$.webp" duration="65.5" startNumber="1" />
<Representation id="150" bandwidth="1000" height="750" width="2810"><EssentialProperty schemeIdUri="http://dashif.org/thumbnail_tile" value="10x5" /></Representation>
<Representation id="250" bandwidth="3500" height="1250" width="4690"><EssentialProperty schemeIdUri="http://dashif.org/thumbnail_tile" value="10x5" /></Representation>
<Representation id="480" bandwidth="10000" height="2400" width="9000"><EssentialProperty schemeIdUri="http://dashif.org/thumbnail_tile" value="10x5" /></Representation>
</AdaptationSet>
</Period>
</MPD>
```
The video starts playing, but when rewinding, a conflict occurs.
```
script_test.js:2 [1551][StreamController] A MEDIA_ERR_DECODE occured: Resetting the MediaSource
script_test.js:2 [1557][VideoModel] Caught pending play exception - continuing (AbortError: The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22)
script_test.js:2 [1575][StreamController] Video Element Error: MEDIA_ERR_SRC_NOT_SUPPORTED (PipelineStatus::CHUNK_DEMUXER_ERROR_APPEND_FAILED: Unexpected element ID 0x3c2144)
script_test.js:2 [1575][StreamController] [object MediaError]
```
It might be a matter of profiles.
```
xmlns="urn:webm:dash:profile:webm-on-demand:2012"
profiles="urn:webm:dash:profile:webm-on-demand:2012"
```
replaced by
```
xmlns="urn:mpeg:dash:schema:mpd:2011"
profiles="urn:mpeg:dash:profile:isoff-on-demand:2011"
```
This didn't solve the problem.
What's wrong?
I'm using VP9, a webm container, the Opus audio codec, and thumbnails. It works, but there's a conflict with the subtitles.Opened by Zuldek1994822—7 hours ago
Subtitle rendering intermittently stopping during playback on Smart TVsHello ,
We are facing an occasional issue where subtitles stop displaying while video playback is still running normally. The behavior appears to be random and so far has been difficult to reproduce.
What we know so far:
- The issue has been reported on Smart TV devices
- We currently don’t have any logs that capture the moment when it happens
- The reports are based mainly on end-user feedback
- Subtitles only reappear after a user interaction, such as seeking in the content
We wanted to check whether this is something you have already encountered, and if you might have any ideas or hypotheses about what could cause this kind of behavior.
Any insight would be greatly appreciated.Opened by testeur-990—15 days ago
Reduce memory allocations in hot paths for Smart TV optimization## Description
Several hot code paths in dash.js use `Object.keys()` patterns that create unnecessary array allocations during playback. On resource-constrained devices like Smart TVs, these allocations contribute to garbage collection pressure, potentially causing playback stutters.
## Affected Areas
| File | Function | Frequency | Issue |
|------|----------|-----------|-------|
| `AbrController.js` | `_onVideoElementResized` | Every video resize | Nested `Object.keys().forEach()` |
| `EventController.js` | `_iterateAndTriggerCallback` | Every 100ms | `Object.keys()` in nested loops |
| `EventController.js` | `_removeOutdatedEventObjects` | Every 100ms | `Object.keys().length === 0` check |
| `HTTPLoader.js` | `_addPathwayCloningParameters` | Every HTTP request | `Object.keys().map()` |
## Proposed Solution
Replace `Object.keys()` patterns with `for..in` loops which iterate directly without creating intermediate arrays.
## Expected Impact
- Reduces ~30-50 array allocations per second during playback
- Lower GC pressure on memory-constrained devices
- More fluid playback on Smart TVs and embedded devices
## Related PR
#4937Opened by PascalThuet—15 days ago






