YouTube videos

This forum is about all development around libVLC.
gt3440
New Cone
New Cone
Posts: 3
Joined: 31 Mar 2015 20:11

YouTube videos

Postby gt3440 » 31 Mar 2015 21:02

Hi there,

I just got my feet wet with vibVLC, and I would appreciate any help on the following problem:

I wrote a little app to play videos which works fine on all test I did except when playing YouTube videos
I handle YouTube urls just as any other url, but with YouTube when the program reaches the state libvlc_Playing I immediately receive event
libvlc_MediaStateChanged and when I check the player state it is set to libvlc_Error.

The same url plays fine with the VLC player, so the problem is definitely in my code.

the seq of VLC calls is the following: ( i pass the YT url as follows: https://www.youtube.com/watch?v=00x6uqY555Q )
inst = libvlc_new (0, NULL);
libvlc_log_set(inst, log_cb, NULL );
vlc_m = libvlc_media_new_location(inst, url ) ;
libvlc_media_parse(vlc_m) ;
vlc_mp = libvlc_media_player_new_from_media(vlc_m);
libvlc_event_manager_t *e_play = libvlc_media_player_event_manager( vlc_mp ) ;
libvlc_event_manager_t *e_media = libvlc_media_event_manager( vlc_m );
libvlc_event_attach(e_media, libvlc_MediaStateChanged, event_callback, NULL );
libvlc_media_player_play( vlc_mp );
while ( libvlc_media_get_state( vlc_m ) <= libvlc_Playing )
{
do something ..
}

Can some one tell me if I am missing something on the above code?
I have turned on the VLC logs but I do not see anything suspicious (all logs are level 0)

Thank you for any help you can give me.

regards, gt

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

Re: YouTube videos

Postby Rémi Denis-Courmont » 31 Mar 2015 21:17

You probably need a media_list_player instead of a media_player.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

gt3440
New Cone
New Cone
Posts: 3
Joined: 31 Mar 2015 20:11

Re: YouTube videos

Postby gt3440 » 31 Mar 2015 21:46

But I am trying to play a single video....

gt3440
New Cone
New Cone
Posts: 3
Joined: 31 Mar 2015 20:11

Re: YouTube videos

Postby gt3440 » 01 Apr 2015 16:41

Ok,
media_list_player did the job. Thanks, Remi!!!

Now i have only one problem left.... how do I get the length of the video when working with list_player?


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 35 guests