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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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;