![无法让媒体播放器和操作在 Unity Webapps 上运行](https://linux22.com/image/822470/%E6%97%A0%E6%B3%95%E8%AE%A9%E5%AA%92%E4%BD%93%E6%92%AD%E6%94%BE%E5%99%A8%E5%92%8C%E6%93%8D%E4%BD%9C%E5%9C%A8%20Unity%20Webapps%20%E4%B8%8A%E8%BF%90%E8%A1%8C.png)
我正在关注 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。如果我不能在此之前完成,我们的错误修复阶段将很快开始。