@Jopyth ,
I managed to have some developments with your remote control module’s sendNotifcation
command. I hooked up the MM using a browser and observed( using dev console, Note to beginners: press F12 on a browser to access this cool feature ) that a notification was send from MM Remote. This means that you were right all along, just that i didnt know how to observe the sendNotification
command via dev console.
Currently, i have another issue. My youtube.js module receives the “PLAY_VIDEO” or “PAUSE_VIDEO” notification but is not able to perform what was desired.
Here’s my snippet of my code from my youtube.js :
notificationReceived: function(notification, payload) {
if (notification === "PAUSE_VIDEO"){
pausethevideo()
}
if (notification === "PLAY_VIDEO"){
playthevideo()
}
},
getDom: function() {
var wrapper = document.createElement("div");
wrapper.className = "thin xlarge bright";
function playthevideo(){
var myPlayer = document.getElementById('my-video');
myPlayer.playVideo();
};
function stopthevideo(){
var myPlayer = document.getElementById('my-video');
myPlayer.stopVideo();
};
function pausethevideo(){
var myPlayer = document.getElementById('my-video');
myPlayer.pauseVideo();
};
wrapper.innerHTML='<div> <div> allowfullscreen></div></div>'; //youtube video link found here.
return wrapper;
}
});
However, i got an error from dev console :
Uncaught TypeError: Cannot read property 'pauseVideo' of null at Class.notificationReceived (youtube.js:69)
Im suspecting that my pauseVideo/playVideo function wasn’t recognised as it is getDom
.
Will appreciate any help or advice !