I'm trying to use delphi 7 to stream a file over http and I had no success so far. I'm using an older VLC (version 0.8.6) that I know works with the DELPHI wrapper I got for delphi 7. I managed to get my simple program to play an mp3 file on the local machine, which is more proof that the wrapper is good for the version of VLC I'm using.
I seem to have problems on the command I'm using to pass to libvlc - maybe not written properly which is due to my ignorance of how VLC works rather than a DLPHI programming problem.
Here's the code I use:
Code: Select all
//CODE INSIDE THE START BUTTON CLICK EVENT
//******START********
//This first part plays a file on the local machine, this works.
//NOTE: variable s contains the name of the mp3 file
vlc:=call('VLC_Create',VLC_Create);
args[0]:=pchar(VLD_LibPath); // Lie or libvlc.dll wont work :(
args[1]:=nil;
call('VLC_Init',VLC_Init(vlc,1,@args[0]));
call('VLC_AddTarget',VLC_AddTarget(vlc,PChar(s),nil,0,PLAYLIST_APPEND,PLAYLIST_END));
call('VLC_Play',VLC_Play(vlc));
//Then I want to start another VLC instance and stream the file 1.mp3 through http, this doesn't work!
vlc2:=call('VLC_Create',VLC_Create);
commands[0]:=pchar(VLD_LibPath); // Lie or libvlc.dll wont work :(
commands[1]:='1.mp3';
commands[2]:= ':sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:http{mux=ffmpeg{mux=flv},dst=:8080/} :no-sout-rtp-sap :no-sout-standard-sap :sout-keep';
call('VLC_Init',VLC_Init(vlc2,3,@commands));
call('VLC_Play',VLC_Play(vlc2));
//The program runs happily but I can't open the stream on the local machine using VLC as client
//*******END************
Code: Select all
main debug: `http://localhost:8080' successfully opened
main debug: Buffering 0%
main debug: EOF reached
...
main debug: nothing to play
Anyone with a little time to spare can give me some ideas on what I might try next?
Many thanks,
Rui