0

My asset has 2 audio streams: english and hungarian. Sometimes hungarian is the second audio stream, not the first, therefore not the default.

I want to always start playback with hungarian audio. I based my code from Cast-Player-Sample.

Attempt:

After this.onMetadataLoadedOrig_(info); (here) I did:

this.protocol.enableStream(2, true); //enables hungarian
this.protocol.enableStream(1, false);
this.player_.reload();

It doesn't work: player goes to IDLE state and nothing is played. BTW, protocol comes from this.protocol = protocolFunc(host) (here)

The only way I could make it work was to start with the default language and change it only after player is in PLAYING state.

How can I start playback with audio other than default (first)?

1

1 Answer 1

0

I figured it out. You have to enable/disable protocol streams in the onManifestReady callback. This way you don't need to call player.reload().

onManifestReady

Notifies the host that a manifest or a master playlist has been loaded and processed by the protocol. This callback can be used to disable the streams enabled by default by the protocol and enable desired streams instead.

Not the answer you're looking for? Browse other questions tagged or ask your own question.