How to give youtube url
Posted: 07 Jul 2010 09:18
Hi all,
I am developing an application in C using libvlc to play youtube videos. I used this api call libvlc_media_new_path to set the url. But it doesn't works. It works if I give a local path and also works when giving url using vlc GUI. Is there any other calls or anything to configure for playing network streamed videos.
Following is my sample code
int main(int argc, char **argv) {
const char * const vlc_args[] = {
"-I", "dumy", // No special interface
"--ignore-config", // Don't use VLC's config
"--plugin-path=./plugins",
"--reset-plugins-cache"
};
libvlc_media_t* m_pMedia;
libvlc_instance_t* m_pVLCInstance = libvlc_new (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args);
libvlc_media_player_t* m_pMediaPlayer = libvlc_media_player_new(m_pVLCInstance);
m_pMedia = libvlc_media_new_path(m_pVLCInstance, "http://www.youtube.com/watch?v=_lP0CmEA6PA&fmt=18");
libvlc_media_player_set_media (m_pMediaPlayer, m_pMedia);
libvlc_media_player_play (m_pMediaPlayer);
Thanks in advance
HK
I am developing an application in C using libvlc to play youtube videos. I used this api call libvlc_media_new_path to set the url. But it doesn't works. It works if I give a local path and also works when giving url using vlc GUI. Is there any other calls or anything to configure for playing network streamed videos.
Following is my sample code
int main(int argc, char **argv) {
const char * const vlc_args[] = {
"-I", "dumy", // No special interface
"--ignore-config", // Don't use VLC's config
"--plugin-path=./plugins",
"--reset-plugins-cache"
};
libvlc_media_t* m_pMedia;
libvlc_instance_t* m_pVLCInstance = libvlc_new (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args);
libvlc_media_player_t* m_pMediaPlayer = libvlc_media_player_new(m_pVLCInstance);
m_pMedia = libvlc_media_new_path(m_pVLCInstance, "http://www.youtube.com/watch?v=_lP0CmEA6PA&fmt=18");
libvlc_media_player_set_media (m_pMediaPlayer, m_pMedia);
libvlc_media_player_play (m_pMediaPlayer);
Thanks in advance
HK