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()之後?文件中的文檔讓我感到困惑。
第一次製作應用程序總是很容易!