dash.js
Open Source Media Player
Seamless and reliable DASH streaming on any browser-based device
View onGitHub
5490
1732
415.5k
Sponsors
Trusted by the industry leaders
Latest updates from GitHub
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—17 hours 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—yesterday
Enhancement: Proactive buffer pruning to prevent QuotaExceededError on Smart TV devices## Problem
Currently, `BufferController` only reacts to `QuotaExceededError` after it occurs:
```javascript
// Current behavior (BufferController.js)
criticalBufferLevel = Number.POSITIVE_INFINITY; // No limit until error
function _onAppended(e) {
if (e.error.code === QUOTA_EXCEEDED_ERROR_CODE) {
_handleQuotaExceededError(); // Reactive, not proactive
}
}
```
This causes issues on Smart TV devices with strict SourceBuffer limits:
- **Tizen**: 50-100MB SourceBuffer limit
- **WebOS**: 50-150MB depending on version
- **FireOS**: Variable limits
By the time `QuotaExceededError` fires, the damage is done:
- Playback may stutter or freeze
- Recovery requires aggressive pruning which can cause visible gaps
- Some devices crash or become unresponsive
## Related Issues
- #2934 - QuotaExceededError causing deadlock
- #3707 - Live streams freeze on WebOS 3 (OPEN)
- #3398 - SourceBuffer is full
## Proposed Solution
Implement proactive buffer pruning that triggers before reaching the quota limit:
1. Set a default `criticalBufferLevel` (e.g., 80 seconds) instead of `POSITIVE_INFINITY`
2. Add a proactive pruning threshold (e.g., 80% of critical level)
3. Trigger pruning when buffer exceeds the threshold, before errors occur
### Expected Behavior
| Scenario | Before | After |
|----------|--------|-------|
| Buffer at 60s | No action | No action |
| Buffer at 65s | No action | **Proactive prune triggered** |
| Buffer at 80s | No action | Already pruned |
| QuotaExceeded | Reactive prune (too late) | Rarely reached |
## Environment
- dash.js version: 5.x
- Primarily affects: Smart TV (Tizen, WebOS, FireOS)
- Also benefits: Low-memory mobile devicesOpened by PascalThuet—3 days ago






