MagicMirror² v2.8.0 is available! For more information about this release, check out this topic.

MMM-AssistantMk2 youtube : start video



  • Hi,

    i use MMM-AssistantMk2 and it’s awesome but i have a problem with youtube and start video. If i say: Smooth criminals Mickael Jackson, a youtube window open but nothing appened. Just a black screen with youtube logo

    I open console and there are errors but i don’t undestand. See below:

    www-widgetapi.js:99 Error while parsing the 'allow' attribute: 'accelerometer;', 'autoplay;', 'encrypted-media;', 'gyroscope;', 'picture-in-picture' are invalid feature names.
    mb @ www-widgetapi.js:99
    :8080/modules/MMM-AssistantMk2//MMM-AssistantMk2.js:744 Uncaught TypeError: console.log is not a function
        at onReady (:8080/modules/MMM-AssistantMk2//MMM-AssistantMk2.js:744)
        at P.k.H (s.ytimg.com/yts/jsbin/www-widgetapi-vflf9U9oY/www-widgetapi.js:54)
        at Y.k.s (s.ytimg.com/yts/jsbin/www-widgetapi-vflf9U9oY/www-widgetapi.js:98)
        at Y.k.I (s.ytimg.com/yts/jsbin/www-widgetapi-vflf9U9oY/www-widgetapi.js:112)
        at kb.g (s.ytimg.com/yts/jsbin/www-widgetapi-vflf9U9oY/www-widgetapi.js:87)
        at g (s.ytimg.com/yts/jsbin/www-widgetapi-vflf9U9oY/www-widgetapi.js:76)
    

    I post my config.js below with MMM-AssistantMK2 and MMM-Hotword:

       		{
        			module: "MMM-AssistantMk2",
        			position: "top_right",
        			config: {
        			deviceLocation: {
          					coordinates: { // set the latitude and longitude of the device to get localized information like weather or time. (ref. mygeoposition.com)
            				latitude: xx.xxxx, // -90.0 - +90.0
            				longitude: x.xxxx // -180.0 - +180.0
          						     },
      					},
        			profiles: {
          				"default" : { // profile name.
            					profileFile: "default.json", // profile file name.
            					lang: "fr-FR"
            					//currently available (estimation, not all tested):
            					//  de-DE, en-AU, en-CA, en-GB, en-US, en-IN
            					// fr-CA, fr-FR, it-IT, ja-JP, es-ES, es-MX, ko-KR, pt-BR
            					// https://developers.google.com/assistant/sdk/reference/rpc/languages
          					    },
    				 },
          			record: {
            		recordProgram : "arecord",  
            		device        : "plughw:1",
          				},
    			play: {
          			playProgram: "mpg321", // recommended.
        			        },
    			transcriptionHook: {
    
            			HIDE_ALL_MODULES: {
                				pattern: "cache les modules",
                				command: "HIDEMODULES"
              					  },
              			SHOW_ALL_MODULES: {
                				pattern: "affiche les modules",
                				command: "SHOWMODULES"
              					  },
              			SCREEN_ON: {
                				pattern: "allume l'écran",
                				command: "SCREENON"
              					},
              			SCREEN_OFF: {
                				pattern: "eteins l'écran",
                				command: "SCREENOFF"
              					},
              			REBOOT: {
                				pattern: "reboot le miroir",
                				command: "REBOOT"
              				},
              			SHUTDOWN: {
                				pattern: "eteins le miroir",
                				command: "SHUTDOWN"
              					},
              			STOP_PLAY: {
                				pattern: "arrête la video", // this is for youtube but it is preferable to have youtubeAutoplay: false, when running spotify so you don't get interaction with youtube player. 
                				command: "STOP_VID"
              					},
             			// STOP_PLAY2: {
             			//   pattern: "arrête la musique",
            			//   command: "STOP_VID"
             			// },
    
    	 			SPOTIFY_PREVIOUS: {
            				pattern: "musique précédente",
            				command: "SPOTIFY_PREVIOUS"
            					},
            			SPOTIFY_PAUSE: {
            				pattern : "stop",
            				command: "SPOTIFY_PAUSE"
            					},
            			SPOTIFY_PLAY: {
            				pattern : "lance la musique",
            				command: "SPOTIFY_PLAY"
            					},
            			SPOTIFY_NEXT: {
            				pattern: "musique suivante",
            				command: "SPOTIFY_NEXT"
            					},
            			SPOTIFY_VOLUME: {
            				pattern: "met le volume à ([0-9]{1,2}[0]?|100)",
            				command: "SPOTIFY_VOLUME"
            					},
            			SPOTIFY_SEARCH: {
            				pattern: "joue (.*) on Spotify",
            				command: "SPOTIFY_SEARCH"
            					},
    				SPOTIFY_SEARCH_PLAYLIST: {
            				pattern: "playlist (.*) sur Spotify",
            				command: "SPOTIFY_SEARCH_PLAYLIST"
            					},
    				SPOTIFY_MA_PLAYLIST: {
    					pattern: "(.*) ma playlist",   // (.*)  is an action  eg: play my playlist / run my playlist etc... 
    					command: "SPOTIFY_MA_PLAYLIST"
    							},
    				SPOTIFY_TRANSFER: {
    					pattern: "joue la musique sur (.*)", // (.*)  is the name of your device
    					command: "SPOTIFY_TRANSFER"
    						},
              			VOLUME_UP: {
                				pattern: "augmente le volume",
                				command: "CMD_VOLUME_UP"
              					},
              			VOLUME_DOWN: {
                				pattern: "baisse le volume",
                				command: "CMD_VOLUME_DOWN"
              					},
              			SET_VOLUME: {
                				pattern: "met le volume global à ([0-9]{1,2}[0]?|100)",
                				command: "CMD_VOLUME_SET"
              						}
            				},
            		command: {
    
              			STOP_VID: {
                				moduleExec: {
                  						module: ["MMM-AssistantMk2"],
                  						exec: (module, params, key) => {
                    									module.assistant.subdom.youtube.innerHTML = ""; 
                    									module.assistant.subdom.youtube.style.display = "none";
                    									module.youtubePlaying = false;
                  										}
                					    }
              			},
    	   			SPOTIFY_TRANSFER: {
    	    				notificationExec: {
                  							notification: "SPOTIFY_TRANSFER",
    	         						payload: (params) => {
                     									console.log("SPOTIFY_TRANSFER @",params)
                    									return params[1];
                            								}
        
    							   }
              					  },
               			SPOTIFY_PAUSE: {
                				notificationExec: {
                  							notification: "SPOTIFY_PAUSE"
                						  }
              					},
    
            			SPOTIFY_PLAY: {
                				notificationExec: {
                    						notification: "SPOTIFY_PLAY"
                    					  }
            				      },
    	
    				SPOTIFY_MA_PLAYLIST: {
    	    				notificationExec:  {
    							notification: "SPOTIFY_PLAY",
    							payload: (params) => {
    							console.log("SPOTIFY_MA_PLAYLIST")
    							return {
    								context_uri:"spotify:playlist:0bdByehKVfdsfdsfdsOhF5t",   // Uri of a personnal playlist or album
    								}
    										},
    							notification: "SPOTIFY_SHUFFLE",  // added this to toogle shuffle
    							notification: "SPOTIFY_NEXT" // added this to not always have the same song starting first 
    							   }
    						    },		
            
    				SPOTIFY_NEXT: {
             				notificationExec: {
                							notification: "SPOTIFY_NEXT"
                    					  }
            				      },
    
            			SPOTIFY_PREVIOUS: {
             				notificationExec: {
                							notification: "SPOTIFY_PREVIOUS"
                    					  }
            					  },
            			SPOTIFY_VOLUME: {
                				notificationExec: {
               							notification: "SPOTIFY_VOLUME",
               							payload: (params) => {
                     								console.log("SPOTIFY_VOLUME @",params)
                    								return params[1];
                            							     }
                    					   }
            					},
    				SPOTIFY_SEARCH: {
             				notificationExec: {
               							notification: "SPOTIFY_SEARCH",
    								payload: (params) => {
                    						console.log("SPOTIFY_SEARCH @",params)
                    						return {
                            						type: "artist,track,album,playlist",
                            						query: params[1],
                            						random:false,
                            						}
                         								     }
                    									}
            						  },
    	 			SPOTIFY_SEARCH_PLAYLIST: {
             				notificationExec: {
               							notification: "SPOTIFY_SEARCH",
    								payload: (params) => {
                    						console.log("SPOTIFY_SEARCH_PLAYLIST @",params)
                    						return {
                            						type: "playlist",
                            						query: params[1],
                            						random:true,
                            						}
                         					  	  		      }
                    					}
            						},
              			CMD_VOLUME_UP: {
                				notificationExec: {
                  						notification: "VOLUME_UP"
                						  }
              					},
              			CMD_VOLUME_DOWN: {
                				notificationExec: {
                  						notification: "VOLUME_DOWN"
                						   }
              					},
              			CMD_VOLUME_SET: {
                				notificationExec: {
                  						notification: "VOLUME_SET",
                  						payload: (params, key) => {
                    								console.log("@", params);
                    								return params[1];
                  									  }
                						  }					
              					}
            			},
    
    
          			notifications: {
            			ASSISTANT_ACTIVATED: "HOTWORD_PAUSE",
            			ASSISTANT_DEACTIVATED: "HOTWORD_RESUME",
          					},
    			responseVoice: true,
    			screenDuration: 5000,
    			youtubeAutoplay: true, //If set as true, found Youtube video will be played automatically.
        			pauseOnYoutube:true, //If set as true, You cannot activate Assistant during youtube playing. Recommended for the performance (Because permanent hotword detecting might make performance lower)
    
        			youtubePlayerVars: { // You can set youtube playerVars for your purpose, but should be careful.
          			"controls": 0,
          			"loop": 1,
          			"rel": 0,
        					   },
        			youtubePlayQuality: "default", //small, medium, large, hd720, hd1080, highres or default
        			}
      		},
      		{
        			module: "MMM-Hotword",
        			config: {
        			snowboy: [
      					{
        					hotwords: "smartmirror", //this will be sent to other module for distinguishing which hotword is detected.
        					file: "resources/models/smart_mirror.umdl",
        					sensitivity: '0.5',
      					},
      					//{
        					//hotwords: "snowboy",
        					//file: "resources/models/snowboy.umdl",
        					//sensitivity: '0.5',
      					//},
      					{
        					file: 'resources/models/jarvis.umdl',
        					sensitivity: '0.8,0.80',
        					hotwords: ['jarvis','jarvis'] //Kitt.ai changed their Jarvis UMDL, it has 2 models in one file. So weird.
        					//anyway, you can give different name for each. ['jarvis_1', 'jarvis_2']. Even though I think this is useless.
      					}
        				],
        			record: {
          				recordProgram : "arecord",  
          				device        : "plughw:1"
        				},
        			autostart:true,
        			onDetected: {
          					notification: (payload) => {
            								return "ASSISTANT_ACTIVATE"
          								   },
          					payload: (payload) => {
            							return {
              								profile: payload.hotword
            								}
          							      }
        				   },
      			},
    		},
    

    Can you help me please?
    thanks for next answers