gapu / google-cast-sdk

Automatically exported from code.google.com/p/google-cast-sdk
0 stars 0 forks source link

Changing audio streams is not working #591

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying to change enabled audio stream, while playing smooth streaming 
content with PlayReady, but it fails. I am using "playing" even in HTML5 video 
element to perform the audio selection:

mediaElement.addEventListener('playing', function(e) {
    setStreamLanguage('audio', 'fin');
});

function setStreamLanguage(streamType, languageCode){
            var streamInfo;

            for(var i = 0; i < protocol.getStreamCount(); ++i) {
                streamInfo = protocol.getStreamInfo(i);

                if (streamInfo.mimeType.indexOf(streamType) == 0) {
                    protocol.enableStream(i, streamInfo.language == languageCode);
                    console.log('cycling throught: ' + streamInfo.mimeType + " " + streamInfo.language + " " +
                                "is selected: " + protocol.isStreamEnabled(i));
                }
            }
        }

In logs it looks that the audio stream change was done, but after this code is 
executed:

* playback stops in a few seconds
* in console appear an error: "Uncaught TypeError: Cannot read property 'Yc' of 
undefined" from media player library

The used manifest: http://usp.neonstingray.com/video/13529/13529.ism/Manifest

Original issue reported on code.google.com by ostap.kr...@neonstingray.com on 5 Jun 2015 at 8:47

GoogleCodeExporter commented 9 years ago
Can you provide the full error logs? Which version of MPL are you using?

Original comment by jonathan...@google.com on 5 Jun 2015 at 10:02

GoogleCodeExporter commented 9 years ago
I am using MPL v1.0.0. Here are logs in attachment.

Original comment by ostap.kr...@neonstingray.com on 8 Jun 2015 at 7:45

Attachments:

GoogleCodeExporter commented 9 years ago
You should be doing the audio track selection in host.onManifestReady 
(https://developers.google.com/cast/docs/reference/player/cast.player.api.Host#o
nManifestReady). If you haven't already looked at it, the player documentation 
may prove useful for you (https://developers.google.com/cast/docs/player). 
Also, when switching audio tracks, make sure that you have only one audio track 
enabled at a time. For any further development issues, please direct your 
questions to Stack Overflow.

Original comment by jonathan...@google.com on 9 Jun 2015 at 10:11

GoogleCodeExporter commented 9 years ago
Works great for me, thanks you for reply. Would be great if media player 
tutorial (https://developers.google.com/cast/docs/player) can be updated, cause 
right now it has no mention about using of "host.onManifestReady" event.

Original comment by ostap.kr...@neonstingray.com on 12 Jun 2015 at 12:06