If you want to play video in the WebBrowser control whose format is mp4, 3gp, etc...(whatever WP support playing), you may notice that the outside built-in IE browser already has the ability and works well.
The built-in IE can auto play video after you navigated the page or you can find a region and tap it to play video. Let's do it in our apps.
First, you need enable script since some playing actions wrote as script(e.g. javascript)
<phone:WebBrowser x:name="Browser" IsScriptenabled="True" Navigating="Browser_Navigating"/>
Second, write some code in the page's xaml.cs file.
private void Browser_Navigating(object sender, NavigatingEventArgs e)
{
if(Your condition for palying or not playing)
{
e.Cancel = true;
MediaPlayerLauncher mPlayer = new MediaPlayerLauncher();
mPlayer.Media = e.Uri;
mPlayer.Show();
}
}
Then you can see it works.
No comments:
Post a Comment