Page 1 of 1

c# - Play youtube videos

Posted: 01 Dec 2011 11:14
by shivan
Hello

I'm trying to play youtube videos using AxAXVLC.AxVLCPlugin2, but it doesn't start playing. Does the controls support playing youtube videos without saving the video first?

I hope someone can help me.

Thanks!

shivan

Re: c# - Play youtube videos

Posted: 01 Dec 2011 12:43
by Rémi Denis-Courmont
Yes.

Re: c# - Play youtube videos

Posted: 01 Dec 2011 13:44
by shivan
But how does it work? How can i start the Video?

Code: Select all

//I couldn't find a play() Method like in the AxVLCPlugin1 Control: //AxVLCPlugin1.play();
A sample would be nice.

Thanks!

shivan

Re: c# - Play youtube videos

Posted: 01 Dec 2011 14:48
by Rémi Denis-Courmont
Play the URL of the YouTube page. You'll need the latest VLC release.

Re: c# - Play youtube videos

Posted: 01 Dec 2011 16:06
by ZeBobo5
Hi,

When your media state changed to ended, you'll have a subitemin on your media. I think the subitemadded event is working too.

The subitem is the true video media.

This is a sample code with Vlc.DotNet library which is compatible with WinForm, WPF & Silverlight 5

Code: Select all

var media = new LocationMedia(@"http://www.youtube.com/watch?v=WAjt5wPJVqM"); media.StateChanged += delegate(MediaBase s, VlcEventArgs<States> args) { if (args.Data == States.Ended) { var subItems = media.SubItems; if (subItems.Count > 0) { myVlcControl.Play(subItems[0]); } } }; myVlcControl.Media = media; myVlcControl.Play();
ZeBobo5

Re: c# - Play youtube videos

Posted: 01 Dec 2011 16:19
by ZeBobo5
The media sub item added event working too.

Code: Select all

var media = new LocationMedia(@"http://www.youtube.com/watch?v=WAjt5wPJVqM"); media.MediaSubItemAdded += delegate(MediaBase s, VlcEventArgs<MediaBase> args) { myVlcControl.Media = args.Data; myVlcControl.Play(); }; myVlcControl.Media = media; myVlcControl.Play();
ZeBobo5