我尝试了不同的方式,但无论我设置为Source
的MediaElement
它什么也没有显示。MediaElement为什么不显示?
我试着这样说:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,0,0,0" Background="White">
<MediaElement x:Name="VideoMediElement" Source="{Binding VideoUrl, Mode=TwoWay}" Width="350" Height="340" Margin="55,33,75,225"></MediaElement>
</Grid>
我试试这个:
VideoMediElement.Source = new Uri(VideoUrl);
VideoMediElement.Play();
其中VideoUrl
是:
private string videoUrl;
public string VideoUrl
{
get { return videoUrl; }
set
{
if (videoUrl != value)
{
videoUrl = value;
OnPropertyChanged("VideoUrl");
}
}
}
我甚至尝试这个办法:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,0,0,0" Background="White">
<MediaElement x:Name="VideoMediElement" Source="http://www.youtube.com/v/zsGczPb-4fg?f=videos" Width="350" Height="340" Margin="55,33,75,225"></MediaElement>
但任何地方我只看到白色背景。为什么? 我使用模拟器版本7.1。
看到这篇文章http://stackoverflow.com/questions/4272293/youtube-on-windows-phone-with-mediaelement –
@Xin但我想不仅播放YouTube视频。 –
您是否试过在设备上播放它?也许模拟器不支持编解码器。 – keyboardP