小编Ben*_*Ben的帖子

SmoothStreamingMediaElement.Play() - 抛出异常但播放器启动

当我设置我的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);
        }
Run Code Online (Sandbox Code Playgroud)

silverlight mediaelement smooth-streaming

5
推荐指数
1
解决办法
1245
查看次数