It turns out that the solution is quite simple. I'll answer the questions in case someone else has the similar problem like me.
First of all, I need additional objects in index.html
head (and moved Audio there also):
<object id="pluginAudio" border=0 classid="clsid:SAMSUNG-INFOLINK-AUDIO"></object>
<object id="pluginObjectTVMW" border="0" classid="clsid:SAMSUNG-INFOLINK-TVMW"></object>
<object id="pluginObjectNNavi" border=0 classid="clsid:SAMSUNG-INFOLINK-NNAVI"></object>
pluginObjectTVMW can be declared in:
var Main =
{
pluginAPI: null
};
Main difference is that I was trying window.onshow
, but it needs to be window.onLoad
, so it should be like this (module has time to load):
Main.onLoad = function(){
window.onLoad = function () {
Main.pluginAPI = document.getElementById("pluginObjectTVMW");
Audio.init();
NNaviPlugin = document.getElementById("pluginObjectNNavi");
NNaviPlugin.SetBannerState(1);
pluginAPI.unregistKey(tvKey.KEY_VOL_UP);
pluginAPI.unregistKey(tvKey.KEY_VOL_DOWN);
//unregister other keys as explained in NNavi module below
}
}
NNavi module explanation from Playing Embedded MP3 with TV Volume On-screen Display tutorial:
The NNavi module controls Samsung Smart TV specific functions (for example, DUID and ServerType ) in the DTV platform. The SetBannerState(nState) function of the NNavi module shows the TV volume. nState is set to ‘1’ to show the volume OSD. To show the Volume OSD on screen, volume keys, Mute , Exit , Menu and Internet@TV keys are unregistered using the unregist() function of Common.API.Plugin.
and the change in Audio is:
Audio.setRelativeVolume = function(delta){
this.plugin.SetVolumeWithKey(delta);
//apply volume to player
Player.plugin.audioVol(this.plugin.GetVolume);
}
One final note is that I've moved Audio plugin to head
tag, instead of inserting it "on demand" like Player, like I've stated in the beginning.
That is basically it. A beginners mistake for not waiting to fully load stuff, but I got tricked by Player (pluginPlayer
) being ready immediately.
Regards