Commit Graph

33 Commits

Author SHA1 Message Date
Álvaro Velad Galván e810f08d19 fix(MSF): handle WebTransport.closed rejection to avoid Safari unhandled promise error (#10056) 2026-05-11 11:07:29 +02:00
Álvaro Velad Galván ba21789c3d fix(MSF): Fix namespace handling (#9988)
Also adds new MSF test streams
2026-04-20 10:57:30 +02:00
Álvaro Velad Galván 90a737961f feat(MSF): Add MoQT draft-16 support (#9966)
A new config is added to config the version: 'auto', 'draft-14',
'draft-16'

---------

Co-authored-by: Wojciech Tyczyński <tykus160@gmail.com>
2026-04-15 12:34:33 +02:00
Álvaro Velad Galván aa2dfaec3f feat(MSF): Add CMSF contentProtection signaling support (#9972)
See https://github.com/moq-wg/cmsf/pull/18
2026-04-14 17:43:45 +02:00
Álvaro Velad Galván d435f9bf15 feat(MSF): Add FETCH support for catalog (#9965) 2026-04-13 13:07:08 +02:00
Álvaro Velad Galván 2db061d654 perf(MSF): Reduce live latency to one segment (#9947)
Co-authored-by: Wojciech Tyczyński <tykus160@gmail.com>
2026-04-09 14:01:11 +02:00
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 e85e74a952 fix(MSF): Add PUBLISH_NAMESPACE_OK response to server PUBLISH_NAMESPACE (#9909) 2026-03-30 12:59:11 +02:00
Álvaro Velad Galván 40e46d5ce3 perf(MSF): Reduce startup latency changing the type of subscribe (#9903) 2026-03-27 12:13:32 +01: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 c272e0bf60 fix(MSF): Correct handling of PUBLISH_DONE (#9893)
Co-authored-by: Wojciech Tyczyński <tykus160@gmail.com>
2026-03-25 11:22:51 +01:00
Álvaro Velad Galván 47ed5accfa fix(MSF): Correct parsing of publishDone message (#9890) 2026-03-24 17:42:17 +01:00
Erik Herz 313d1ce952 fix(MSF): handle SUBSCRIBE_NAMESPACE (0x11) control message (#9871) 2026-03-23 10:35:30 +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 0c0a47c8d6 fix(MSF): Use bigint natively (#9826)
Many relays use large numbers and with the current implementation it
doesn't always work.

See Closure's limitations here:
https://github.com/google/closure-compiler/wiki/BigInt-support
2026-03-14 10:51:09 +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 184ae48f6d fix(MSF): support draft-14 SubgroupHeader types (0x10-0x1D) (#9802)
## Problem

The SubgroupHeader stream type detection only covers the draft-11 range
(`0x08-0x0D`), missing the two new ranges added in draft-14:

- `0x10-0x15`: without EndOfGroup
- `0x18-0x1D`: with EndOfGroup


https://www.ietf.org/archive/id/draft-ietf-moq-transport-14.html#section-10.4.2-5

When a relay or publisher sends a stream with a type in the new ranges
(e.g., `0x10`), it is treated as an unknown stream type and not
processed. Media data on that stream is lost.

## Changes

- Expand stream type checks, extension header detection, and SubgroupID
resolution logic to cover the new ranges
- Remove unused constants (`SUBGROUP_HEADER_START_BIGINT`,
`SUBGROUP_HEADER_END_BIGINT`)

## Testing

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

Existing behavior for `0x08-0x0D` is preserved (pure addition).

---------

Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2026-03-09 12:10:13 +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
Daiki Matsui 6630340682 fix(MSF): fix namespace tuple encoding in SUBSCRIBE message (#9803)
## Summary

`subscribeTrack()` in `msf_tracks_manager.js` wraps the namespace string
as a 1-element tuple (e.g., `["moq-chat/chat"]`) instead of splitting it
back into the original tuple (e.g., `["moq-chat", "chat"]`).

These produce different bytes on the wire, so the relay cannot match the
SUBSCRIBE against the publisher's namespace. This affects all SUBSCRIBE
messages including catalog, video, and audio tracks.

## Details

Internally, Shaka Player represents the namespace as a `/`-joined string
(see `subscribeToCatalog_()` in `msf_parser.js:341`).

When encoding a SUBSCRIBE message, the string must be split by `/` to
reconstruct the original tuple. But the code was using `[namespace]`
instead of `namespace.split('/')`.

## Changes

Replace `namespace: [namespace]` with `namespace: namespace.split('/')`
in `subscribeTrack()`.

## 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:45:51 +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