Windows Phone 实用开发技巧(21):自动循环播放视频
来源:Alexis的51博客 责任编辑:栏目编辑 发表时间:2013-07-02 01:49 点击:次
In Windows Phone Mango update, we can use VideoBrush since we could not do that in windows phone 7 . So there is something interesting to do. We can develop more fantasitic apps. For example, we can play a video as background in our application. We want to play video in a loop also. But here comes the problem. Since there is no MediaTimeline in Silverlight for Windows Phone API. How can we repeat media playback ?
In WPF or Silverlight, we can use following code to repeat media playback.
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<StackPanel>
<!-- The MediaElement control plays the sound. -->
<MediaElement Name="myMediaElement" >
<MediaElement.Triggers>
<EventTrigger RoutedEvent="MediaElement.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<!-- The MediaTimeline has a RepeatBehavior="Forever" which makes the media play
over and over indefinitely.-->
<MediaTimeline Source="media
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<StackPanel>
<!-- The MediaElement control plays the sound. -->
<MediaElement Name="myMediaElement" >
<MediaElement.Triggers>
<EventTrigger RoutedEvent="MediaElement.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<!-- The MediaTimeline has a RepeatBehavior="Forever" which makes the media play
over and over indefinitely.-->
<MediaTimeline Source="media
相关新闻>>
最新推荐更多>>>
热门新闻进入移动开发频道>>
- 发表评论
-
- 最新评论 更多>>