SmoothStreamingSource を設定してから .Play() を呼び出すと、次の例外が発生します...
「ソースセットがない場合は再生できません。」
奇妙なことに、この例外 (以下のコードを参照) を処理すると、ビデオの再生が開始されます。奇数?msdn によると、SmoothStreamingSource プロパティは Source プロパティを自動的に設定するため、例外が発生することはありません。コードをステップ実行すると、SmoothStreamingSource プロパティの設定後に Source プロパティが設定されていることが確認できます。
これが内部でより大きな問題の兆候である場合は、例外を処理するだけでなく、陽気な道を進みたいと思います。
これどうしたの?私のコード...
try
{
Uri uri = (Uri)((Button)source).Tag;
smoothStreamingMediaElement1.SmoothStreamingSource = uri;
if (smoothStreamingMediaElement1.SmoothStreamingSource != null)
MessageBox.Show(smoothStreamingMediaElement1.SmoothStreamingSource.ToString());
else
MessageBox.Show("SmoothStreamingSource is NULL");
smoothStreamingMediaElement1.Play();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}