如何播放YouTube视频中的Windows Phone 7? [英] How to Play youtube videos in windows phone 7?

查看:190
本文介绍了如何播放YouTube视频中的Windows Phone 7?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是初学的Windows Phone 7。
在这里我的问题是,我们如何才能在我们的Windows Phone 7应用程序直接播放视频从网页的网址?

I am Beginner in Windows phone 7. and here my question is that "How can we play the video from page url directly in our application in windows phone 7 ??"

例如,
页面的URL = http://www.youtube.com/watch?v=EhfuBLe7sio

和我想在我与MediaPlayerLauncher或应用MediaElement的播放该视频

and i want to play that video in my application with MediaPlayerLauncher or MediaElement

请,给我答案..
在等..

Please, Give me Answer.. m waiting..

推荐答案

最后,
我解决了我的问题与工具包。codePLEX的帮​​助。

And finally, I solved my question with the help of Toolkit.codeplex.

和我在Windows Phone应用程序使用此code直接播放YouTube视频。

and i played the youtube video directly in my windows phone application using this code.

    public delegate void mymethod(YouTube.YouTubeUri myuri, Exception myexec);

    mymethod mm;

    private void BtnGetVideo_Click(object sender, RoutedEventArgs e)
    {
        SystemTray.ProgressIndicator.IsVisible = true;
        var url = YouTube.GetVideoUri("CT3dsZhCjsk", YouTubeQuality.Quality1080P, myCompleted);
    }

    public void myCompleted(YouTube.YouTubeUri uri, Exception e)
    {
        Dispatcher.BeginInvoke(new mymethod(nikdemo), uri, e);
        // i used Dispatcher.BeginInvoke. and invoked my delegate until it will gives the error like Invalid cross-thread Operation.

    }

    public void nikdemo(YouTube.YouTubeUri uu, Exception ee)
    {
        //MyMedia.Source = uu.Uri;

        string retr = uu.Uri.ToString();
        MyMedia.Source = new Uri(retr,UriKind.Absolute);
        MyMedia.Play();
        MyMedia.AutoPlay=true;
        SystemTray.ProgressIndicator.IsVisible = false;
    }

终于我看到在我的Windows Phone应用程序你管的视频。

And finally i seen that you tube video in my application on windows phone.

这篇关于如何播放YouTube视频中的Windows Phone 7?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆