c# - Play youtube videos

This forum is about all development around libVLC.
shivan
New Cone
New Cone
Posts: 2
Joined: 01 Dec 2011 10:50

c# - Play youtube videos

Postby shivan » 01 Dec 2011 11:14

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

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: c# - Play youtube videos

Postby Rémi Denis-Courmont » 01 Dec 2011 12:43

Yes.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

shivan
New Cone
New Cone
Posts: 2
Joined: 01 Dec 2011 10:50

Re: c# - Play youtube videos

Postby shivan » 01 Dec 2011 13:44

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

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: c# - Play youtube videos

Postby Rémi Denis-Courmont » 01 Dec 2011 14:48

Play the URL of the YouTube page. You'll need the latest VLC release.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

ZeBobo5
Blank Cone
Blank Cone
Posts: 17
Joined: 17 Nov 2006 11:38

Re: c# - Play youtube videos

Postby ZeBobo5 » 01 Dec 2011 16:06

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

ZeBobo5
Blank Cone
Blank Cone
Posts: 17
Joined: 17 Nov 2006 11:38

Re: c# - Play youtube videos

Postby ZeBobo5 » 01 Dec 2011 16:19

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


Return to “Development around libVLC”

Who is online

Users browsing this forum: fractal-1 and 19 guests