Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
||
ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
[18.119.116.102] |
|
Сообщ.
#1
,
|
|
|
С удивлением обнаружил, что в оном нет аналога дельфийского mediaplayer. Поиск по сети дал ссылку на http://ffmpeg.org/index.html
Смутило, что Цитата ffplay is a simple media player based on SDL and the FFmpeg libraries. Нет ли, так сказать, "более простых путей"? |
Сообщ.
#2
,
|
|
|
В официальном вики есть пример проигрывания через mplayer
|
Сообщ.
#3
,
|
|
|
miksayer
Спасибо. Попробую Ваш способ. И вдогонку вопрос: Нашел в ДРКБ код, который работает и в Лазарусе unit Unit1; {$mode delphi}{$H+} interface uses Windows,Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, MMSystem; type { TForm1 } TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { private declarations } public { public declarations } end; var Form1: TForm1; implementation { TForm1 } procedure TForm1.Button1Click(Sender: TObject); const longName: PChar = 'speedis.avi'; {Your complete FileName} var ret, shortName: PChar; err: DWord; begin {Getting the short Name (8:3) of selected file} shortName := strAlloc(521); GetShortPathName(longName, shortname, 512); {Sending a close Command to the MCI} ret := strAlloc(255); err := mciSendString(pchar('close movie'), 0, 0, 0); {No error check because at the first call there is no MCI device to close} {Open a new MCI Device with the selected movie file} err := mciSendString(pchar('open ' + shortName + ' alias movie'), 0, 0, 0); shortName := nil; {If an Error was traced then display a MessageBox with the mciError string} if err <> 0 then begin mciGetErrorString(err, ret, 255); messageDlg(ret, mtInformation, [mbOk], 0); end; {Sending the "play fullscreen command to the Windows MCI} err := mciSendString(pchar('play movie fullscreen'), 0, 0, 0); {Use the following line instead of the above one if you want to play it in screen mode} err := mciSendString(pchar('play movie'), 0, 0, 0); {If an Error was traced then display a MessageBox with the mciError string} if err <> 0 then begin mciGetErrorString(err, ret, 255); messageDlg(ret, mtInformation, [mbOk], 0); end; ret := nil; //err := mciSendString(pchar('close movie'), 0, 0, 0); end; initialization {$I unit1.lrs} end. Проблема только одна, после проигрывания видеофайла остается окошко с видео, которое приходится закрывать пользователю, что неудобно. Вот и не могу понять, куда вставить код err := mciSendString(pchar('close movie'), 0, 0, 0); Если вставлять в обработчике, то видео сразу закрывается после открытия |
Сообщ.
#4
,
|
|
|
Оззя, а запустить в режиме
err := mciSendString(pchar('play movie wait'), 0, 0, 0); // <--- Ожидания, пока не закончится {If an Error was traced then display a MessageBox with the mciError string} if err <> 0 then begin mciGetErrorString(err, ret, 255); messageDlg(ret, mtInformation, [mbOk], 0); end; ret := nil; err := mciSendString(pchar('close movie'), 0, 0, 0); // <--- А как закончится - закрыть не пойдет? Правда тогда до тех пор, пока видео не проиграет, форма будет недоступна... Или 'play movie notify' и обработка MM_MCINOTIFY в функции окна, как только сообщение пришло - значит, видео проигралось полностью, окно можно закрывать... |
Сообщ.
#5
,
|
|
|
Цитата volvo877 @ не пойдет? ... Пойдет, пойдет! Цитата Правда тогда до тех пор, пока видео не проиграет, форма будет недоступна Это не важно. Точнее, так и нужно! Спасибо огромное! |