Is there a correct way for playing media located on a FTP server using libvlc?
After creating the media & media player,
libvlc_media_player_play
returns 0,
libvlc_media_player_get_state
returns libvlc_Error, and
libvlc_errmsg
returns "(null)"
The official feature page for VLC lists FTP as supported input & the FTP link is playable using a VLC media player instance.
Code is pretty basic, same as most examples found online:
libvlc_media_t *m = libvlc_media_new_location( inst, "ftp://127.0.0.1:3531/path_to_movie.avi");
if ( !m )
return false;
libvlc_media_player_t* mp = libvlc_media_player_new_from_media(m);
if ( !mp )
return false;
libvlc_media_release(m);
libvlc_media_player_play(mp);
After play was called, nothing happens. Thanks in advance for helping.
After enabling verbose debug output (as suggested by gollum), found that the problem was due to wrong creation of libvlc_media_t *m
.
Basically I have a URI checker to determine if link contains path to a local file or a remote file.
libvlc_media_t *m = IsLocalFile(pszMediaPath) ? libvlc_media_new_path(inst, pszMediaPath) : libvlc_media_new_location(inst, pszMediaPath);
IsLocalFile(pszMediaPath)
was wrongly implemented (always returning true), resulting in calling of libvlc_media_new_path
even for URIs, which caused libvlc_media_player_play
to fail because the path to remote media was bogus.