Commit Graph

19 Commits

Author SHA1 Message Date
Wojciech Tyczyński e2cf6a1724 chore: Replace PublicPromise with Promise.withResolvers (#9925)
Stop using `shaka.util.PublicPromise` and replace it with modern
`Promise.withResolvers()` API, that is [widely implemented
already](https://caniuse.com/wf-promise-withresolvers).

Polyfill is already included by Closure Compiler:
https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/js/es6/promise/withResolvers.js

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2026-04-07 16:11:29 +02:00
Álvaro Velad Galván 0522d0b1dc feat(MSF): Make subscribe filter type configurable (#9941) 2026-04-07 10:47:23 +02:00
Álvaro Velad Galván 83cc35161e feat(MSF): Add authorizationToken support (#9916) 2026-04-07 09:54:45 +02:00
Álvaro Velad Galván 76d655bed6 perf(MSF): Improve compatibility with the draft-14 (#9895)
More types of messages are now supported than before. 
SubscribeError handling has been improved.
A new error has been added when no catalog.
Existing messages have been reviewed to eliminate inconsistencies in the
migration from draft-11 to draft-14 support.
Fix log levels
2026-03-26 09:46:40 +01:00
Álvaro Velad Galván ecfccbb367 fix(MSF): Improve buffer management (#9831)
Allow evict the buffer more aggressive in MSF streams
Do not create a prefetch because for MSF it is not necessary because the
data is always in the segments.
Set MSF streams as low latency.
2026-03-17 20:35:17 +01:00
Álvaro Velad Galván 59c41c17ed fix(MSF): Fix target latency support (#9825) 2026-03-12 14:54:15 +01:00
Álvaro Velad Galván c2bd00a5e7 fix(MSF): Add support for moqtail relay (#9819)
A workaround is added to support bigint.
And support chunk-per-object packaging.
2026-03-11 20:40:47 +01:00
Álvaro Velad Galván 4eec222888 fix(MSF): Remove minimum segment availability duration (#9812) 2026-03-10 18:09:57 +01:00
Álvaro Velad Galván c35d3de92e chore(MSF): Change the catalog log from debug to info (#9813)
Debugging WebTransport connections is not easy; this helps to visualize
the MSF catalog more easily.
2026-03-10 17:46:41 +01:00
Erik Herz 04eab23047 fix(MSF): prevent video segment eviction during initial buffering (#9809)
## Summary

- In MSF live streams, audio and video segments arrive at different
wall-clock times over WebTransport (audio frames are ~8KB vs ~125KB
video keyframes, so audio arrives first).
- The first stream type to deliver a segment calls `lockStartTime()` and
`setSegmentAvailabilityDuration(0.5)`, creating a tight availability
window. When the other type's segments arrive even slightly later,
`mergeAndEvict` immediately evicts them because they fall before
`getSegmentAvailabilityStart()`.
- This causes video to never render — StreamingEngine repeatedly logs
`(video:N) cannot find segment` because every video segment is evicted
on arrival.

### Fix

1. Added `firstSegmentStartTimes_` map to track the first segment start
time per content type.
2. Before the timeline is locked, pass `0` as the eviction start to
`mergeAndEvict` to prevent premature segment eviction.
3. Only call `lockStartTime()` once ALL expected stream types (audio AND
video) have received at least one segment.
4. Set `segmentAvailabilityDuration` wide enough to cover the gap
between the earliest and latest stream start times (`gap + duration`),
so the stream whose segments arrived first isn't continuously evicted.

Co-authored-by: Erik Herz <erik@vivoh.com>
2026-03-10 10:35:31 +01:00
Erik Herz 0db1349898 fix(MSF): fall back to session namespace for media subscribes (#9808)
## Summary

- When MSF catalog track objects don't include an explicit `namespace`
field, `subscribeToTrack` falls through to an empty string. This causes
SUBSCRIBE messages with an empty namespace that the relay cannot match
to any published broadcast.
- The MSF catalog spec does not require per-track namespace fields — the
namespace is established at the transport level via PUBLISH_NAMESPACE.
Shaka should fall back to the session namespace.
- Fix: fall back to `config.msf.namespaces`, then to
`publishNamespaces_` (from PUBLISH_NAMESPACE), before defaulting to
empty string.

---------

Co-authored-by: Erik Herz <erik@vivoh.com>
Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2026-03-09 21:04:33 +01:00
Daiki Matsui 268236759e fix(MSF): move catalog typedefs to externs to prevent property mangling (#9804)
## Summary

MSF works in uncompiled mode but fails with error 4058
(`MSF_VOD_CONTENT_NOT_SUPPORTED`) in the compiled build.

## Cause

The `MSFTrack` and `MSFCatalog` typedefs are defined in regular source
code (`msf_utils.js`). Closure Compiler mangles their property names in
the compiled build (e.g., `track.isLive` → `track.sa`).

Since the catalog is received as external JSON via `JSON.parse()`, the
actual keys remain unchanged and all property accesses return
`undefined`.

Moving the typedefs to an externs file tells Closure Compiler to
preserve the property names.

## Changes

- Move `MSFTrack` and `MSFCatalog` typedefs to a new externs file
(`externs/msf_catalog.js`) with the `@externs` annotation
- Update type references in `msf_parser.js` to use the new extern types
- Remove the original typedefs from `msf_utils.js`

## Testing

Tested manually with a draft-14 publisher
([moqtail](https://github.com/moqtail/moqtail)) and relay
([moq-wasm](https://github.com/nttcom/moq-wasm)).

---------

Co-authored-by: Claude Code <noreply@anthropic.com>
2026-03-09 09:47:28 +01:00
Álvaro Velad Galván 48b553a595 fix(MSF): Fix CMSF catalog parsing (#9710)
It's better use the packaging instead of the mimetype to check the
compatibility
2026-02-13 16:16:22 +01:00
Andy(김규회) d98169bc25 feat(EME): Add retryLicensing() and failureCallback for manual license retry (#9638)
So basically, when a license request fails (eg. network Error, server
down whatever), apps can now retry from scratch by calling
`player.retryLicensing()`. This was tricky to implement because of EME
spec limitations: `generateRequest()` can only be called once per
session. So if it fails, it would be stuck.

So I close the old session and create a brand new one with the same
`initData`

> Will Video element throw an error during this process?

we were worried that closing the session would leave the video without
keys for a brief moment, potentially triggering errors. But in practice,
the transition is fast enough( I added a 0.1s delay for CDM clean up)
and the video element handles it gracefully

> Will new encrypted event fire? If not, will it limit this feature?

The encrypted event only fires when the browser first encounters
encrypted content. When we close and recreate a session, the content is
already loaded, so no new event

Solutions: In `CreateSession()` metadata store `initData` and
`initDataType` in the session metadata when the session is first
created. So when `retryLicensing()`is called, we just grab the stored
data and pass it to `generateRequest()` on the new session. No need to
wait for an `encrypted` event at all.

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
Co-authored-by: Wojciech Tyczyński <tykus160@gmail.com>
2026-02-05 14:12:30 +01:00
Álvaro Velad Galván c3b84615a4 feat: Update catalog format to MSF/CMSF v0 and standardize MOQ terminology (#9614)
Implemented MSF/CMSF v0 specifications
- Catalog structure now follows draft-ietf-moq-msf-00
- CMAF packaging follows draft-ietf-moq-cmsf-00

MOQ naming consistency
- Changed "MoQ" → "MOQ"
- Renamed MoQObject interface to MOQObject
2026-01-28 07:39:12 +01:00
Álvaro Velad Galván a9df794849 fix(MSF): Do not re-encapsulate Shaka errors (#9613) 2026-01-27 14:05:13 +01:00
Álvaro Velad Galván 4c945af650 feat(MSF): Add support for custom namespaces via config (#9586) 2026-01-22 14:00:12 +01:00
Álvaro Velad Galván f1de698b97 feat: Add application/mp4 as valid mimetype on MoQ (#9558) 2026-01-14 11:23:11 +01:00
Álvaro Velad Galván ef361ed039 feat: Add MoQT draft-14 + WARP/MSF draft-1 experimental support (#9409)
Spec: https://datatracker.ietf.org/doc/draft-ietf-moq-transport/14/
Spec: https://datatracker.ietf.org/doc/draft-ietf-moq-warp/01/

Note: this is experimental and not included in the default builds

---------

Co-authored-by: Wojciech Tyczyński <tykus160@gmail.com>
2026-01-14 09:27:10 +01:00