2013-10-29 38 views
0

我只有文件Uri才能在MediaElement中打开。 如何使用_MediaElement.SetSource和Uri?我的方法是基于此示例:文件Uri到StorageFile或Stream

var file = await openPicker.PickSingleFileAsync(); 
var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read); 
mediaControl.SetSource(stream, file.ContentType); 

但是,我只有Uri从文件。有任何想法吗?如果你有一个stream对象

mediaControl.Source = myUri; 

SetSource是比较合适的:

回答

0

如果你有Uri,你应该在MediaElement使用Source属性。

+0

http://stackoverflow.com/questions/19576394/how-to-play-file-from-library-by-mediaelement – sahap