You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"No Representation in the chosen "+adaptation.type+" Adaptation can be played",
{tracks: [toTaggedTrack(adaptation)]},
);
thrownoRepErr;
}
returnrepresentations[0].getMimeTypeString();
}
If I want to use another audio codec based on user preferences, I need to manually call setAudioTrack method. This is works at most of cases except the device that not support seamless audio codec switch, which means every audio codec changes will lead to a reload.
Solution
Provide a initialAudioCodec option and change getFirstDeclaredMimeType method to based on initialAudioCodec, if no initialAudioCodec specified, then fallback to first available audio codec.
The text was updated successfully, but these errors were encountered:
Normally you can set the audio track based on codecs before the RxPlayer has made any choice (and thus not have a reload) by reacting to the newAvailablePeriods event. For example:
player.addEventListener("newAvailablePeriods",(periods)=>{for(constperiodofperiods){constaudioTracks=player.getAvailableAudioTracks(period.id);// use external logic to select the wanted audio track based on the codecconstchosenAudioTrack=chooseAudioTrack(audioTracks);if(chosenAudioTrack){player.setAudioTrack({periodId: period.id,trackId: chosenAudioTrack.id,});}}});
At what point do you update the audio track? If it's e.g. at the "LOADED" state it may be late because the RxPlayer already has loaded audio data (from the previous track).
Yeah, just as you said, I set the initial audio codec at LOADED state. I'll try set it when first newAvailablePeriods event fired and see if it solve the problem.
Context
Currently rx-player use the first audio codec as default audio codec:
rx-player/src/core/stream/period/period_stream.ts
Lines 472 to 485 in 7b24c52
If I want to use another audio codec based on user preferences, I need to manually call
setAudioTrack
method. This is works at most of cases except the device that not support seamless audio codec switch, which means every audio codec changes will lead to areload
.Solution
Provide a
initialAudioCodec
option and changegetFirstDeclaredMimeType
method to based oninitialAudioCodec
, if noinitialAudioCodec
specified, then fallback to first available audio codec.The text was updated successfully, but these errors were encountered: