开发者

Launching media player from WeBrowser control

开发者 https://www.devze.com 2023-03-06 01:21 出处:网络
I have an application that shows HTML via the WebBrowser control. There are also links to mp4 videos in this HTML.

I have an application that shows HTML via the WebBrowser control. There are also links to mp4 videos in this HTML.

WebBrowser does nothing if I click on video links. However, if page is opened through WebBrowserTask then links work and open media player 开发者_StackOverflow中文版(video is then normally played).

Can webbrowser also somehow open media player and play video?

Is there any other way to play video from HTML (html5 is not supported, flash is not supported - any other way)?

Thx all, Ratko


You can hook up the containing page to receive the Navigating events from the WebBrowser, check the URL, and if it is for one of the media links, cancel the navigation and instead play the media ...

        <phone:WebBrowser 
            IsScriptEnabled="True" 
            Navigating="WebBrowserNavigating"
        />


    private void WebBrowserNavigating(object sender, NavigatingEventArgs e)

        if (e.Uri.OriginalString.StartsWith(MediaLinkUrl))
        {
            e.Cancel = true;
            // use the MediaPlayerLauncher to play the media from the URL
        ....
0

精彩评论

暂无评论...
验证码 换一张
取 消