Skip to content

Expose isSpatialAudio to representationFilter - #1943

Merged
peaBerberian merged 4 commits into
canalplus:devfrom
gmcgarry:dolby/gmcga-spatial-audio-filter
Dec 1, 2026
Merged

peaBerberian merged 4 commits into
canalplus:devfrom
gmcgarry:dolby/gmcga-spatial-audio-filter

Conversation

@gmcgarry

@gmcgarry gmcgarry commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Pass each Representation's isSpatialAudio value to the representationFilter callback, so applications can filter out spatial variants on systems without a spatial render. For example, Safari supports Dolby Digital Plus with Atmos and plain Dolby Digital Plus depending on the target speakers. The Spatializer is a system-configurable setting in Android.

  • Add isSpatialAudio to IRepresentationFilterRepresentation (public_types.ts).
  • Copy isSpatialAudio into the filter input in Adaptation (adaptation.ts).
  • Add a unit test that checks the flag reaches the filter and that a filter can exclude spatial Representations.

Sample MPD is available here: https://chromium.dolby.link/ts_ref_kit/clear/heaac-ddp51-ddpjoc_nf/manifest.mpd

A Sample player with representationFilter implementation is available here: https://player.dolby.link/rx.html?url=https%3A%2F%2Fchromium.dolby.link%2Fts_ref_kit%2Fclear%2Fheaac-ddp51-ddpjoc_nf%2Fmanifest.mpd&autoplay=true

@peaBerberian

Copy link
Copy Markdown
Collaborator

Thanks for the contribution!


Note that representationFilter is not the API intended for Representation selection,lockAudioRepresentations is and contains a lot more information such as the other representations and tracks available in the content.
representationFilter main goal is to act just like the representation was never present in the Manifest when you know in advance and in isolation that a representation characteristics will not be wanted at all .

This API is here and often used by apps instead of lockAudioRepresentations because the latter is more complex to approach for sometimes simple application requirements.


Anyway I agree this makes sense and it is a development which follows the architecture well.
The doc should also need a light update (most likely doc/api/Miscellaneous/plugins.md).

@gmcgarry

gmcgarry commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for your response!

I investigated the alternate approach of listening to the availableAudioTracksChange event and using player.setAudioTrack(). I didn't like this approach for a few reasons:

  • The UI still see the atmos tracks on non-atmos systems
  • The application logic becomes complicated to track user selections and atmos filtering

The case here, is that for devices that don't support Atmos, we really do want the representations to be eliminated from selection. This is done by checking MediaCapabilities.decodingInfo() and representationFilter seems like the correct place to do this. I didn't make that clear in the PR comment. I will update the PR comment.

Add isSpatialAudio to the Representation properties listed for the
representationFilter callback in plugins.md.
@gmcgarry

Copy link
Copy Markdown
Contributor Author

I updated plugins.md per reviewer feedback.

@peaBerberian

peaBerberian commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

To note first that I agree with your modifications and that I also agree that for cases where you know anyway you won't be able to rely on Dolby Atmos, using representationFilter would be the right choice.

Your changes look good, and your PR+example+reason for the change is very appreciated, it makes the review process much easier for us and I think we will probably merge this.

Don't pay attention to the sonarcloud CI job failing here.

To answer some points quickly:

The UI still see the atmos tracks on non-atmos systems

Here the RxPlayer library does not actually expose any UI (we have our demo page but it's a simple demo implementation).

The UI will in the end be defined by the application, which decides what tracks to present to the user. Most applications using us have already-complex requirements and thus adding some filter between what e.g. getAvailableAudioTracks() returns and what their UI diplays is not an issue.

availableAudioTracksChange

This event could be a candidate for single-Period contents, but the intended and most complete event for track and representation automatic selection is newAvailablePeriods, allowing for much more advanced scenarios (e.g. to signal in advance the wanted tracks for future Periods as they're preloaded - like future TV programs and ads, fallbacking to the right track if the one initially selected is impossible to decrypt etc.).

This and other reasons is why we do consider our track/representation API a little complex and thus also kept simpler but less powerful APIs. To note that many applications, like the ones at Canal+, need and use the complex ones though, so it's a real need.

The case here, is that for devices that don't support Atmos, we really do want the representations to be eliminated from selection. This is done by checking MediaCapabilities.decodingInfo() and representationFilter still seems like the correct place to do this. I didn't make that clear in the PR comment. I will update the PR comment.

Cool thanks, we could see on our side if we could rely on this type of API for spatial audio checks.

The mediaCapabilitiesProber is not used a lot for now in the apps we know of because many devices have poor support (worse than not having the API, they will tell you e.g. they "support" thing they don't or the reverse), so many actual checks have been more ad-hoc per-device.

@gmcgarry

gmcgarry commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for sharing your insights. I understand your frustration with capability checks! :)

@peaBerberian
peaBerberian merged commit c11823b into canalplus:dev Dec 1, 2026
11 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants