Skip to content

Conversation

@Florent-Bouisset
Copy link
Collaborator

Currently, the player throws an error if either all audio or all video tracks are not playable. This PR introduces two new options, onAudioTrackNotPlayable and onVideoTrackNotPlayable, to the loadVideo method. These options allow the player to continue playback even when all audio or video tracks are not playable. In such cases, the content will play without audio or video, respectively, instead of failing.

API

loadVideo(options) options object has two more keys:

  • [optional]onAudioTrackNotPlayable : "continue" or "error". Default if not set: "continue"
  • [optional]onVideoTrackNotPlayable : "continue" or "error". Default if not set: "continue"

Usage

  player.loadVideo({
    transport: "dash",
    url: "https://dash.akamaized.net/dash264/TestCasesDolby/1/Living_Room_1080p_20_96k_25fps.mpd",
    autoPlay: true,
    onAudioTrackNotPlayable: "continue",
    onVideoTrackNotPlayable: "error",
  });

Example

https://codesandbox.io/p/sandbox/amazing-pare-kdf65f

@Florent-Bouisset Florent-Bouisset added the API Relative to the RxPlayer's API label Jan 6, 2025
@Florent-Bouisset Florent-Bouisset force-pushed the feat/play-without-audio-or-video branch from 724b4a3 to 5a073f9 Compare January 6, 2025 09:30
@Florent-Bouisset
Copy link
Collaborator Author

relates to #1602

@peaBerberian
Copy link
Collaborator

onAudioTrackNotPlayable and onVideoTrackNotPlayable

Shouldn't it be "tracks" here?

Default if not set: "continue"

Doesn't it break the API this way? Its complex but it changes the default behavior on which some applications may rely? Wouldn't it be safer to default it to "error"?

@Florent-Bouisset
Copy link
Collaborator Author

onAudioTrackNotPlayable

Yes I think I should default it to "error" instead.

@Florent-Bouisset
Copy link
Collaborator Author

onAudioTrackNotPlayable and onVideoTrackNotPlayable

Shouldn't it be "tracks" here?

Default if not set: "continue"

Doesn't it break the API this way? Its complex but it changes the default behavior on which some applications may rely? Wouldn't it be safer to default it to "error"?

I have updated it.

@Florent-Bouisset Florent-Bouisset force-pushed the feat/play-without-audio-or-video branch from ef25c83 to 4b6acd7 Compare January 9, 2025 10:39
@peaBerberian
Copy link
Collaborator

peaBerberian commented Jan 9, 2025

As this adds a similar logic in the TrackStore + Manifest + Init, and as the manifest is more or less intended to just regroup metadata, I'm wondering if it would not be easier to follow if that option was mainly handled by a part of the Init (and TrackStore I guess for its own thing) : Like the Manifest would parse the content regardless, and the Init would investigate the issues seen while parsing and decide whether to error or warn and continue based on its options.

What do you think?

@Florent-Bouisset Florent-Bouisset force-pushed the feat/play-without-audio-or-video branch 2 times, most recently from 5e29ebe to dc7bfe7 Compare January 31, 2025 09:37
@Florent-Bouisset Florent-Bouisset force-pushed the feat/play-without-audio-or-video branch from 40f9dfa to d9cd1bb Compare March 12, 2025 15:15
"NO_PLAYABLE_REPRESENTATION",
`No ${trackType} Representation can be played`,
{ tracks: undefined },
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this event now is also sent when the codec is not supported? That's a big change

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error was also sent in previous version

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for when the codec wasn't supported which now can happen due to the "continue" part

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, I'm wondering if a MANIFEST_INCOMPATIBLE_CODECS_ERROR error wouldn't be preferable

@Florent-Bouisset Florent-Bouisset force-pushed the feat/play-without-audio-or-video branch from d9cd1bb to 48f85a9 Compare April 15, 2025 07:53
@github-actions
Copy link

✅ Automated performance checks have passed on commit aa092a705a40b1daa5c47a6f2a5e86e1dbc77ae3 with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 19.48ms -> 19.97ms (-0.487ms, z: 0.82174) 26.55ms -> 26.55ms
seeking 20.10ms -> 15.99ms (4.112ms, z: 0.77060) 11.25ms -> 11.25ms
audio-track-reload 26.41ms -> 26.52ms (-0.112ms, z: 0.76331) 38.55ms -> 38.55ms
cold loading multithread 48.97ms -> 47.44ms (1.533ms, z: 13.82425) 70.65ms -> 69.15ms
seeking multithread 18.60ms -> 23.30ms (-4.708ms, z: 0.82484) 10.50ms -> 10.35ms
audio-track-reload multithread 26.58ms -> 26.56ms (0.025ms, z: 1.16192) 39.00ms -> 38.85ms
hot loading multithread 15.57ms -> 15.42ms (0.142ms, z: 4.09236) 22.50ms -> 22.20ms

@Florent-Bouisset Florent-Bouisset force-pushed the feat/play-without-audio-or-video branch from 48f85a9 to 28dbe1f Compare April 15, 2025 12:24
@github-actions
Copy link

✅ Automated performance checks have passed on commit 58a747efae1487fb37e5c6a857f0853f18663dec with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 19.49ms -> 19.70ms (-0.214ms, z: 0.13174) 26.55ms -> 26.55ms
seeking 22.84ms -> 22.17ms (0.676ms, z: 0.78719) 11.25ms -> 11.25ms
audio-track-reload 26.91ms -> 26.93ms (-0.013ms, z: 0.16848) 39.15ms -> 39.15ms
cold loading multithread 48.47ms -> 48.06ms (0.402ms, z: 13.03305) 70.95ms -> 69.60ms
seeking multithread 18.02ms -> 20.63ms (-2.606ms, z: 0.64152) 10.35ms -> 10.50ms
audio-track-reload multithread 26.74ms -> 26.69ms (0.047ms, z: 0.32830) 39.15ms -> 39.15ms
hot loading multithread 15.94ms -> 15.72ms (0.220ms, z: 5.36399) 23.10ms -> 22.65ms

@peaBerberian peaBerberian force-pushed the dev branch 3 times, most recently from 00fc806 to b7216b4 Compare April 15, 2025 18:14
@canalplus canalplus deleted a comment from github-actions bot Apr 22, 2025
@canalplus canalplus deleted a comment from github-actions bot Apr 22, 2025
expect(playerError.message).toBe(
"NO_AUDIO_VIDEO_TRACKS: No audio and no video tracks are set.",
);
});
Copy link
Collaborator

@peaBerberian peaBerberian Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add a second video-disabling test which re-enables the video on the noPlayableTrack for audio?

Just as it seems to me like a potential application use case.

E.g. let's imagine an application that allows for both audio-only and onAudioTracksNotPlayable: "continue".
The user enabled audio-only mode, and the next Period is only in "ec-3" audio that their device does not support.
In that case, it could make sense for the application to prefer re-enabling video over throwing an error (both throwing or continuing video-only make as much sense to me - so their choice :D):

player.addEventListener("noPlayableTrack", (evt) => {
  if (evt.type === "audio" && player.getVideoTrack(evt.periodId) === null) {
    // ... reset videoTrack to something.
  }
});

to ensure we're not breaking that potential usage we could add a test to check that we're not stopping the content before the application had a time to re-enable video, I think. Do you agree?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed it is hard to do this test now, we may do it later

@peaBerberian
Copy link
Collaborator

peaBerberian commented Jun 3, 2025

CI is failing but I think it's just due to older gh-actions dependencies that since recently leads to an HTTP 422.

I since fixed it on dev (by just updating those deps) so just rebasing should be enough

@peaBerberian
Copy link
Collaborator

Hm it's difficult to review, I think a rebase needs to be done.

Also there are some comments without answers so I'm unsure of their status in your POV, maybe the best would be to set a meeting to see all of this so we can work towards merging this nice addition instead of keeping it in limbos.

This add "onAudioTracksNotPlayable" and "onVideoTracksNotPlayable" that
defines the behavior of the player upon encountering a track that is not playable.
With value "continue", the player will play the content without the unsupported
track type.
With value "error", the player will trigger an error. (behavior before this change)
@Florent-Bouisset Florent-Bouisset force-pushed the feat/play-without-audio-or-video branch from b4a0bf2 to ad128b5 Compare June 24, 2025 14:17
@github-actions
Copy link

✅ Automated performance checks have passed on commit f1a2ddf439bf3e0c636b9427983b8d052b4075c3 with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 19.33ms -> 19.41ms (-0.084ms, z: 0.44954) 26.55ms -> 26.55ms
seeking 18.38ms -> 13.77ms (4.611ms, z: 0.45902) 10.95ms -> 10.95ms
audio-track-reload 25.57ms -> 25.58ms (-0.017ms, z: 0.94376) 37.40ms -> 37.50ms
cold loading multithread 46.17ms -> 46.02ms (0.151ms, z: 13.59698) 67.50ms -> 66.30ms
seeking multithread 49.10ms -> 43.11ms (5.988ms, z: 0.58313) 10.20ms -> 10.20ms
audio-track-reload multithread 25.68ms -> 25.58ms (0.097ms, z: 1.53218) 37.65ms -> 37.50ms
hot loading multithread 14.74ms -> 14.55ms (0.183ms, z: 4.56057) 21.30ms -> 21.15ms

@peaBerberian peaBerberian force-pushed the feat/play-without-audio-or-video branch from 1bf9e8e to e2d10f3 Compare June 27, 2025 13:03
@github-actions
Copy link

✅ Automated performance checks have passed on commit 9e340468e01744071b21db263709a6fa2f6336eb with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 21.58ms -> 21.59ms (-0.014ms, z: 0.70282) 29.85ms -> 29.70ms
seeking 18.84ms -> 23.49ms (-4.647ms, z: 0.36569) 11.40ms -> 11.55ms
audio-track-reload 27.67ms -> 27.58ms (0.092ms, z: 1.23477) 40.20ms -> 40.35ms
cold loading multithread 50.33ms -> 48.86ms (1.470ms, z: 12.42526) 72.90ms -> 71.55ms
seeking multithread 78.09ms -> 66.76ms (11.330ms, z: 0.80268) 10.20ms -> 10.35ms
audio-track-reload multithread 27.56ms -> 27.37ms (0.187ms, z: 1.34048) 40.50ms -> 40.35ms
hot loading multithread 17.41ms -> 17.22ms (0.196ms, z: 2.06416) 25.05ms -> 25.05ms

@peaBerberian peaBerberian merged commit cd2b12c into dev Jun 30, 2025
12 checks passed
@github-actions
Copy link

✅ Automated performance checks have passed on commit 9678af64f76d2b40b23199340bd52d3eadf85077 with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 20.04ms -> 20.06ms (-0.025ms, z: 0.07548) 27.60ms -> 27.60ms
seeking 13.95ms -> 19.96ms (-6.006ms, z: 0.15783) 11.25ms -> 11.10ms
audio-track-reload 26.31ms -> 26.38ms (-0.069ms, z: 0.50820) 38.55ms -> 38.70ms
cold loading multithread 47.07ms -> 46.23ms (0.846ms, z: 13.50417) 69.00ms -> 67.65ms
seeking multithread 43.91ms -> 45.93ms (-2.029ms, z: 0.03625) 10.20ms -> 10.35ms
audio-track-reload multithread 26.29ms -> 26.34ms (-0.053ms, z: 0.16970) 38.70ms -> 38.70ms
hot loading multithread 15.47ms -> 15.32ms (0.149ms, z: 2.69442) 22.20ms -> 22.20ms

@peaBerberian peaBerberian added this to the 4.4.0 milestone Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Relative to the RxPlayer's API Priority: 2 (Medium) This issue or PR has a medium priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants