0

サウンドをダウンロードして、次の.mp3ような拡張子で保存します。

var response = await client.GetStreamAsync(fileUrl);

using (IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream(filePath, FileMode.Create, isolatedStorage))
{
    using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
    {
        await response.CopyToAsync(fileStream);
    }
}

IsolatedStorage分離ストレージ ビューアで見ると、そこにファイルが表示され、再生することもできます。

アクセスして再生したい:

IsolatedStorageFile isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();

IsolatedStorageFileStream fileStream = isolatedStorage.OpenFile(filePath, FileMode.Open, FileAccess.Read);

musicMediaElement.SetSource(fileStream);
musicMediaElement.Play();
}

何も聞こえません。何が悪いのかわかりません。

4

1 に答える 1

1

SetSource() の直後に Play() を呼び出さないでください。MediaOpened イベントをフックし、MedaiOpened イベント ハンドラで Play() を呼び出す必要があります。

于 2013-12-12T23:36:35.807 に答える