|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | |
Dialogs, StdCtrls, ExtCtrls, MPlayer, XPMan, ComCtrls; | |
Tmainform = class(TForm) | |
Panel1: TPanel; | |
Button1: TButton; | |
Button2: TButton; | |
Button3: TButton; | |
Button4: TButton; | |
Button5: TButton; | |
Button6: TButton; | |
Label1: TLabel; | |
filepathedit: TEdit; | |
Button7: TButton; | |
MediaPlayer: TMediaPlayer; | |
Panel2: TPanel; | |
TrackBar: TTrackBar; | |
Timer: TTimer; | |
procedure Button1Click(Sender: TObject); | |
procedure FormCreate(Sender: TObject); | |
procedure Button7Click(Sender: TObject); | |
procedure Button2Click(Sender: TObject); | |
procedure Button3Click(Sender: TObject); | |
procedure Button4Click(Sender: TObject); | |
procedure Button5Click(Sender: TObject); | |
procedure Button6Click(Sender: TObject); | |
procedure TimerTimer(Sender: TObject); | |
procedure TrackBarEnter(Sender: TObject); | |
mainform: Tmainform; | |
playlistshown, videoformshown, usrchange: boolean; | |
k, track: integer; | |
uses playlistunit, movieunit; | |
procedure Tmainform.Button1Click(Sender: TObject); | |
if playlistshown = false then | |
playlistshown := true; | |
playlist.Show; | |
playlistshown := false; | |
playlist.Close; | |
procedure Tmainform.FormCreate(Sender: TObject); | |
procedure Tmainform.Button7Click(Sender: TObject); | |
if videoformshown = false then | |
videoform.Show; | |
videoformshown := true; | |
videoformshown := false; | |
videoform.Close; | |
procedure Tmainform.Button2Click(Sender: TObject); | |
if filepathedit.Text <> '' then | |
if (playlist.plslistbox.Items.Count > -1) then | |
track := playlist.plslistbox.ItemIndex; | |
mediaplayer.FileName := filepathedit.Text; | |
mediaplayer.Open; | |
mediaplayer.Play; | |
videoform.moviepanel.Width := mediaplayer.DisplayRect.Right; | |
videoform.moviepanel.Height := mediaplayer.DisplayRect.Bottom; | |
videoform.Width := videoform.moviepanel.Width+20; | |
videoform.Height := videoform.moviepanel.Height+40; | |
procedure Tmainform.Button3Click(Sender: TObject); | |
procedure Tmainform.Button4Click(Sender: TObject); | |
videoform.moviepanel.Width := 369; | |
videoform.moviepanel.Height := 185; | |
procedure Tmainform.Button5Click(Sender: TObject); | |
if playlist.plslistbox.Items.Count > -1 then | |
if track > 0 then | |
dec (track) else track := playlist.plslistbox.Items.Count - 1; | |
filepathedit.Text := playlist.plslistbox.Items.Strings[track]; | |
mediaplayer.FileName := filepathedit.Text; | |
mediaplayer.Open; | |
mediaplayer.Play; | |
procedure Tmainform.Button6Click(Sender: TObject); | |
if playlist.plslistbox.Items.Count > -1 then | |
if track < (playlist.plslistbox.Items.Count - 1) then | |
inc (track) else track := 0; | |
filepathedit.Text := playlist.plslistbox.Items.Strings[track]; | |
mediaplayer.FileName := filepathedit.Text; | |
mediaplayer.Open; | |
mediaplayer.Play; | |
procedure Tmainform.TimerTimer(Sender: TObject); | |
if (mediaplayer.Mode = mpPlaying) or (mediaplayer.Mode = mpPaused) then | |
if usrchange = true then | |
timer.Enabled := false; | |
usrchange := false; | |
mediaplayer.Stop; | |
mediaplayer.StartPos := (mediaplayer.TrackLength[0] div 100)*trackbar.Position; | |
mediaplayer.Play; | |
timer.Enabled := true; | |
trackbar.Position := (mediaplayer.Position) div (mediaplayer.Length div 100); | |
procedure Tmainform.TrackBarEnter(Sender: TObject); | |
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | |
Dialogs, ExtCtrls; | |
Tvideoform = class(TForm) | |
moviepanel: TPanel; | |
procedure FormClose(Sender: TObject; var Action: TCloseAction); | |
videoform: Tvideoform; | |
uses mainunit, playlistunit; | |
procedure Tvideoform.FormClose(Sender: TObject; var Action: TCloseAction); | |
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | |
Dialogs, StdCtrls; | |
Tplaylist = class(TForm) | |
plslistbox: TListBox; | |
Button1: TButton; | |
Button2: TButton; | |
Button3: TButton; | |
OpenDialog: TOpenDialog; | |
procedure Button1Click(Sender: TObject); | |
procedure Button2Click(Sender: TObject); | |
procedure Button3Click(Sender: TObject); | |
procedure FormClose(Sender: TObject; var Action: TCloseAction); | |
procedure plslistboxClick(Sender: TObject); | |
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); | |