2013-02-20 44 views
0

我一直在试图让背景音频工作很多今晚!音频标签'msAudioCategory'的HTML5属性看起来不是有效的。这很奇怪,我无法在任何地方找到这个问题的帮助。背景流Windows 8?

如果我不明白你的答案,请高级对不起。 我default.js(开始于一个随机点,使之短):

app.onactivated = function (args) { 
     if (args.detail.kind === activation.ActivationKind.launch) { 
      if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { 

      } else { 
       // TODO: This application has been reactivated from suspension. 
       // Restore application state here. 
      } 
      args.setPromise(WinJS.UI.processAll()); 
     } 
    }; 

    app.oncheckpoint = function (args) { 
     // TODO: This application is about to be suspended. Save any state 
     // that needs to persist across suspensions here. You might use the 
     // WinJS.Application.sessionState object, which is automatically 
     // saved and restored across suspension. If you need to complete an 
     // asynchronous operation before your application is suspended, call 
     // args.setPromise(). 
     // Declare a variable that you will use as an instance of an object 
     var mediaControls; 

     // Assign the button object to mediaControls 
     mediaControls = Windows.Media.MediaControl; 

     // Add an event listener for the Play, Pause Play/Pause toggle button 
     mediaControls.addEventListener("playpausetogglepressed", playpausetoggle, false); 
     mediaControls.addEventListener("playpressed", playbutton, false); 
     mediaControls.addEventListener("pausepressed", pausebutton, false); 
     mediaControls.addEventListener("stoppressed", stop, false); 

     // The event handler for the play/pause button 
     function playpausetoggle() { 
      if (mediaControls.isPlaying === true) { 
       document.getElementById("playback").pause(); 
      } else { 
       document.getElementById("playback").play(); 
      } 
     } 

     // The event handler for the pause button 
     function pausebutton() { 
      document.getElementById("playback").pause(); 
     } 

     // The event handler for the play button 
     function playbutton() { 
      document.getElementById("playback").play(); 
     } 
     // The event handler for the stop button 
     function stop() { 
      document.getElementById("playback").pause(); 
      document.getElementById("playback").currentTime = 0; 
     } 
    }; 

    app.start(); 

} 
() 


); 

元素标签:

<audio id="audtag" autoplay="autoplay" msAudioCategory="BackgroundCapableMedia" src="http://-Hidden-:8000/;"> 

</audio> 

我敢肯定,我已经配置好了一切。我确定我有背景功能或设置的东西。但是,它仍然表示音频元素属性“msAudioCategory”不是有效的HTML5。我在哪里将JavaScript放在default.js中以定义该属性?在app.start()之后?文件中的文档让我感到困惑。

第一次制作应用程序总是很容易!

回答

0

您是否在应用清单中设置了正确的声明? 您需要添加后台任务并将任务类型设置为音频和控制通道。

我刚刚在C#上的这个工作昨天的样品