8,734
社区成员
发帖
与我相关
我的任务
分享
<Grid>
<StackPanel Margin="0,0,-183,-93">
<MediaElement Width="200" Height="300" x:Name="audio" Stretch="Uniform"></MediaElement>
<Button Content="点击">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<MediaTimeline Source="E:\Camera\VID_20131201_065948.mp4" Storyboard.TargetName="audio"></MediaTimeline>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>
</Grid>
自己修改 Source 路径,另你电脑的Windows Media Player 版本必须 10 或者以上。[/quote]
有没有不要求用户电脑上MediaPlayer版本的元素可以用?
难道我发个软件还要给用户捆绑一个MediaPlayer安装上么?[/quote]
看看这个先,http://www.codeproject.com/Tips/613335/MediaPlayer-in-WPF[/quote]
这个里边用的也是MediaElement啊 我现在的问题是在XP中无法播放视频,但是安装了一个MediaPlayer11之后就能播放了 我是说有没有一种控件是不需要MediaPlayer版本支持的?
<Grid>
<StackPanel Margin="0,0,-183,-93">
<MediaElement Width="200" Height="300" x:Name="audio" Stretch="Uniform"></MediaElement>
<Button Content="点击">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<MediaTimeline Source="E:\Camera\VID_20131201_065948.mp4" Storyboard.TargetName="audio"></MediaTimeline>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>
</Grid>
自己修改 Source 路径,另你电脑的Windows Media Player 版本必须 10 或者以上。[/quote]
有没有不要求用户电脑上MediaPlayer版本的元素可以用?
难道我发个软件还要给用户捆绑一个MediaPlayer安装上么?[/quote]
看看这个先,http://www.codeproject.com/Tips/613335/MediaPlayer-in-WPF
<Grid>
<StackPanel Margin="0,0,-183,-93">
<MediaElement Width="200" Height="300" x:Name="audio" Stretch="Uniform"></MediaElement>
<Button Content="点击">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<MediaTimeline Source="E:\Camera\VID_20131201_065948.mp4" Storyboard.TargetName="audio"></MediaTimeline>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>
</Grid>
自己修改 Source 路径,另你电脑的Windows Media Player 版本必须 10 或者以上。[/quote]
有没有不要求用户电脑上MediaPlayer版本的元素可以用?
难道我发个软件还要给用户捆绑一个MediaPlayer安装上么?
<Grid>
<StackPanel Margin="0,0,-183,-93">
<MediaElement Width="200" Height="300" x:Name="audio" Stretch="Uniform"></MediaElement>
<Button Content="点击">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<MediaTimeline Source="E:\Camera\VID_20131201_065948.mp4" Storyboard.TargetName="audio"></MediaTimeline>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>
</Grid>
自己修改 Source 路径,另你电脑的Windows Media Player 版本必须 10 或者以上。[/quote]
<MediaElement Height="300" x:Name="audio" Stretch="Uniform" MediaFailed="MediaElement_Main_MediaFailed_1"></MediaElement>
<Button Content="点击">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<MediaTimeline Source="/Videos/asd.mp4" Storyboard.TargetName="audio"></MediaTimeline>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
private void MediaElement_Main_MediaFailed_1(object sender, ExceptionRoutedEventArgs e)
{
Console.WriteLine(e.ErrorException.Message + e.ErrorException.InnerException);
}
说到底就是个路径问题 果然还是不行
<Grid>
<StackPanel Margin="0,0,-183,-93">
<MediaElement Width="200" Height="300" x:Name="audio" Stretch="Uniform"></MediaElement>
<Button Content="点击">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<MediaTimeline Source="E:\Camera\VID_20131201_065948.mp4" Storyboard.TargetName="audio"></MediaTimeline>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>
</Grid>
自己修改 Source 路径,另你电脑的Windows Media Player 版本必须 10 或者以上。