我正在关注 API 文档http://developer.ubuntu.com/api/ubuntu-12.04/javascript/
我的代码非常简单:
var Unity = external.getUnityObject(1,0);
Unity.init({name: "Radio Battletoads",
iconUrl: "http://new.radiobattletoads.com/images/icon.png",
onInit: setupMediaPlayer
});
function unityPlayPause(){
// TODO
}
function setupMediaPlayer() {
// Test the Media Player
Unity.MediaPlayer.init("Radio Battletoads");
var trackInfo = {title: "Todo",
album: null,
artist: null,
artLocation: null};
Unity.MediaPlayer.setTrack(trackInfo);
// Test an action
Unity.addAction('/Reproducir', unityPlayPause);
// Test a notification
Unity.Notification.showNotification("Test","Test",null);
}
通知已显示,但媒体播放器和操作均不起作用。我查看了捆绑的用户脚本,没有发现与我的代码有任何显著差异。
有人经历过这样的事吗?
安装版本:
$ dpkg -l | grep unity-webapps
ii libunity-webapps-chromium 1.9-0precise2 Unity WebApp extension for chromium/chrome browser
ii libunity-webapps0 1.9.1-0precise2 Web Apps integration with the Unity desktop
ii unity-webapps 1.9-0precise2 Unity WebApp integration scripts
ii unity-webapps-preview 2.1 Unity Webapps Preview metapackage
ii unity-webapps-service 1.9.1-0precise2 Service for Web Apps integration with the Unity desktop
答案1
你被咬了LP:1031933。在 Unity.init 调用中,从 name: 参数中删除空格,一切就都正常了。这是我的 TODO。如果我不能在此之前完成,我们的错误修复阶段将很快开始。