How to play FLV (Flash Video) in Delphi?

F-IN-BOX is a Delphi component to enhance Adobe Flash Player ActiveX features. It does not use its own engine to display movies but provide a wrapper around official flash.ocx code instead. Thus it is possible to avoid certain Macromedia / Adobe Flash Player ActiveX limitations.

Using F-IN-BOX you can play FLV files from any source: from a file, an URL, an RTMP source, or directly from TStream:


Look at the code:

procedure TMainForm.LoadFLVfromURLClick(Sender: TObject);  
var  
   form: TURLForm;  
   rs: TResourceStream;  
   FlashVars: WideString;  
begin  
   form := TURLForm.Create(Self);  
   form.Caption := 'URL';  
  
   form.Left := Left + Width div 2 - form.Width div 2;  
   form.Top := Top + Height div 2 - form.Height div 2;  
  
   if form.ShowModal = mrOK then  
   begin  
      FlashVars := 'type_video=flv&url=' + form.URL + '&auto_play=';  
  
      if CheckBoxAutoPlay.Checked then  
         FlashVars := FlashVars + 'true'  
      else  
         FlashVars := FlashVars + 'false';  
  
      FlashPlayerControl1.FlashVars := FlashVars;  
  
      rs := TResourceStream.Create(0, 'VideoPlayer', 'FLASH');  
      FlashPlayerControl1.PutMovieFromStream(rs);  
      rs.Free;  
   end;  
  
   form.Free;  
end;  
  
procedure TMainForm.LoadFLVfromRTMPSource1Click(Sender: TObject);  
var  
   form: TURLForm;  
   rs: TResourceStream;  
   FlashVars: WideString;  
begin  
   form := TURLForm.Create(Self);  
   form.Caption := 'RTMP Source';  
  
   form.Left := Left + Width div 2 - form.Width div 2;  
   form.Top := Top + Height div 2 - form.Height div 2;  
  
   if form.ShowModal = mrOK then  
   begin  
      FlashVars := 'type_video=rtmp&url=' + form.URL + '&auto_play=';  
  
      if CheckBoxAutoPlay.Checked then  
         FlashVars := FlashVars + 'true'  
      else  
         FlashVars := FlashVars + 'false';  
  
      FlashPlayerControl1.FlashVars := FlashVars;  
  
      rs := TResourceStream.Create(0, 'VideoPlayer', 'FLASH');  
      FlashPlayerControl1.PutMovieFromStream(rs);  
      rs.Free;  
   end;  
  
   form.Free;  
end;