0

今夜はバックグラウンド オーディオをかなりの時間機能させようとしています。オーディオ タグ 'msAudioCategory' の HTML5 属性が有効ではないようです。かなり奇妙です。この問題のヘルプがどこにも見つかりません。

あなたの答えが理解できない場合は、あらかじめご容赦ください。私の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 ではありません。その属性を定義するには、default.js のどこに JavaScript を配置すればよいですか? app.start() の後? ファイル内のドキュメントは私にとって混乱を招きます。

初めてアプリを作成するのは、常に簡単なことです。

4

1 に答える 1

0

アプリマニフェストに正しい宣言を設定しましたか?バックグラウンドタスクを追加し、タスクタイプをオーディオおよびコントロールチャネルとして設定する必要があります。

昨日、これをC#サンプルで動作させました

于 2013-02-21T10:33:12.737 に答える