在Windows 8中挂起时,背景音频停止

时间:2013-10-07 20:02:58

标签: c# windows-store-apps winjs

我有一个应用程序将播放用HTML / JS for Windows 8编写的互联网mp3流。

即使应用程序在后台,我希望它继续播放音频,但是,它仍然不起作用。

我试过以下

  • 将msAudioCategory =“BackgroundCapableMedia”添加到我的音频标签
  • 在声明中添加了音频作为后台任务
  • 我已将playpausetogglepressed,playpressed,stoppressed和pausepressed eventlisteners添加到mediacontrols
    mediaControl = Windows.Media.MediaControl;

    // Add event listeners for PBM notifications to illustrate app is
    // getting a new SoundLevel and pass the audio tag along to the function

    mediaControl.addEventListener("soundlevelchanged", $scope.soundLevelChanged, false);

    // Add event listeners for the mandatory media commands.
    // These are necessary to play streams of type 'backgroundCapableMedia'
    mediaControl.addEventListener("playpausetogglepressed", $scope.playpause, false);
    mediaControl.addEventListener("playpressed", $scope.play, false);
    mediaControl.addEventListener("stoppressed", $scope.stop, false);
    mediaControl.addEventListener("pausepressed", $scope.pause, false);

我似乎无法弄清楚我错过了什么。

0 个答案:

没有答案