0

I'm developing a CAF web receiver, but I can't hear the Google Assistant voice on the Nest HUB when an error is raised in the setMessageInterceptor for type "LOAD", instead it works for type "SEEK".

This is the code for SEEK:

playerManager.setMessageInterceptor(
    cast.framework.messages.MessageType.SEEK, seekData => {
        let e = new cast.framework.messages.ErrorData(cast.framework.messages.ErrorType
            .LOAD_CANCELLED);
        e.reason = cast.framework.messages.ErrorReason.PARENTAL_CONTROL_RESTRICTED;
        return e;
    });

and this for LOAD:

playerManager.setMessageInterceptor(
    cast.framework.messages.MessageType.LOAD, loadRequestData => {
        let e = new cast.framework.messages.ErrorData(cast.framework.messages.ErrorType
            .LOAD_CANCELLED);
        e.reason = cast.framework.messages.ErrorReason.PARENTAL_CONTROL_RESTRICTED;
        return e;
    });

Obviously, the real "LOAD" case is more complex but also if I use the Google code here (https://developers.google.com/cast/docs/web_receiver/core_features#error_handling) I can't hear any voice. I'm using the CaC Tool https://casttool.appspot.com/cactool/index.html for the entity flow.

playerManager.setMessageInterceptor(
    cast.framework.messages.MessageType.LOAD, loadRequestData => {
        
        const error = new cast.framework.messages.ErrorData(cast.framework.messages.ErrorType.LOAD_CANCELLED);
        
        loadRequestData.media = null; // trying to force error

        if (!loadRequestData || !loadRequestData.media) {
            error.reason = cast.framework.messages.ErrorReason.INVALID_PARAM;
            return error;
        } 
        
        ...
        
        return loadRequestData;
    });
Fabio
  • 13
  • 6
  • Is there an expectation that you would hear a voice? – Nick Felker Nov 25 '20 at 17:05
  • Yes, it is. Because if I'm watching a series and I need to buy the next episode, I want that the Google Assistant voice says "you need to buy the content". The same if the next episode has a parental control level higher than that the user has. – Fabio Nov 25 '20 at 17:20
  • I see. Would it be possible for you to implement this on your own end instead? – Nick Felker Nov 30 '20 at 22:08
  • It would be wonderful, have you got a guide or an example for it? Thanks – Fabio Dec 01 '20 at 08:35
  • I'm not really sure if there's a guide, but I believe you should be able to use the [web speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API) to generate speech directly through the Cast runtime. – Nick Felker Dec 01 '20 at 17:54

0 Answers0