alexa / alexa-smart-screen-sdk

⛔️ DEPRECATED Active at https://github.com/alexa/avs-device-sdk
Apache License 2.0
76 stars 25 forks source link

Open Jeopardy after start music or news, music or news not stopped. #134

Closed zhaokai3000 closed 2 years ago

zhaokai3000 commented 2 years ago

IMPORTANT: Before you create an issue, please take a look at our Issue Reporting Guide.

Briefly summarize your issue:

After starting music or news, try to ask Alexa to open Jeopardy. News or music still playing in the background, while Jeopardy is playing in the front. Two sounds mixed together.

What is the expected behavior?

News broadcast is stopped after Jeopardy starts.

What behavior are you observing?

Still broadcasting news while Jeopardy is playing.

Provide the steps to reproduce the issue, if applicable:

Step1. Ask Alexa for some news, start broadcasting flash briefings; Step2, Ask Alexa to open Jeopardy.

Tell us about your environment:

What version of the AVS Device SDK are you using?

2.9.2

Tell us what hardware you're using:

Tell us about your OS (Type & version):

Have you tried the same use case with AVS Device SDK SampleApp?

powj commented 2 years ago

Thank you for bringing this to our attention, we have been able to reproduce this issue and will be investigating.

1cengizk commented 2 years ago

@zhaokai3000 You can apply the following patch as a workaround for this problem, while we are working on a permanent fix.

You can modify the following lines as follows and then rebuild: https://github.com/alexa/alexa-smart-screen-sdk/blob/master/modules/GUI/js/src/lib/media/AVSAudioPlayer.ts#L93-L94

super.onError(id, reason);
if (reason.toString().includes(`TypeError: Cannot read properties of undefined (reading 'component')`)) return;
this.playing = false;
zhaokai3000 commented 2 years ago

@zhaokai3000 You can apply the following patch as a workaround for this problem, while we are working on a permanent fix.

You can modify the following lines as follows and then rebuild: https://github.com/alexa/alexa-smart-screen-sdk/blob/master/modules/GUI/js/src/lib/media/AVSAudioPlayer.ts#L93-L94

super.onError(id, reason);
if (reason.toString().includes(`TypeError: Cannot read properties of undefined (reading 'component')`)) return;
this.playing = false;

Will try. Thanks!

zhaokai3000 commented 2 years ago
    public onError(id : string, reason : string) : void {
        super.onError(id, reason);
        if (reason.toString().includes(`TypeError: Cannot read properties of undefined (reading 'component')`)) {
            return;
        }
        this.playing = false;
        this.releaseFocus();
        if (this.activityToken !== undefined) {
            this.activityTracker.recordInactive(this.activityToken);
            this.activityToken = undefined;
        }
    }

@1cengizk Sorry but the workaround seems doesn't work. Still have news mixed with Jeopardy sounds.

powj commented 2 years ago

Hi @zhaokai3000, could you add console.log(reason); at the beginning of the onError function above, then provide the console logs from your browser.

zhaokai3000 commented 2 years ago

Sorry that I forgot to mention that I tested this on my arm linux device last time, which is running smart screen sdk 2.9.2. Console log for the reason is: TypeError: Cannot read property 'component' of undefined

I tested this change again on ubuntu running smart screen sdk 2.9.1 and it works. Console log for the reason is: TypeError: Cannot read properties of undefined (reading 'component')

powj commented 2 years ago

Thank you for providing these logs, to enable both cases to be caught I recommend modifying the check to be: if (reason.toString().includes("TypeError:")) return;

zhaokai3000 commented 2 years ago

The workaround patch works. Thanks!