You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-09-30 21:28:55 +02:00
Update to CEF 83.5.0
This commit is contained in:
@@ -55,21 +55,43 @@ object MediaRouterFrm: TMediaRouterFrm
|
||||
Left = 12
|
||||
Top = 25
|
||||
Width = 226
|
||||
Height = 616
|
||||
Height = 579
|
||||
Align = alClient
|
||||
ItemHeight = 13
|
||||
TabOrder = 0
|
||||
OnClick = SinksLbxClick
|
||||
ExplicitHeight = 616
|
||||
end
|
||||
object SinksButtonsPnl: TPanel
|
||||
Left = 12
|
||||
Top = 641
|
||||
Top = 604
|
||||
Width = 226
|
||||
Height = 74
|
||||
Height = 111
|
||||
Align = alBottom
|
||||
BevelOuter = bvNone
|
||||
Padding.Top = 10
|
||||
TabOrder = 1
|
||||
object GetDeviceInfoBtn: TButton
|
||||
Left = 0
|
||||
Top = 47
|
||||
Width = 226
|
||||
Height = 27
|
||||
Caption = 'Get device info'
|
||||
Enabled = False
|
||||
TabOrder = 0
|
||||
OnClick = GetDeviceInfoBtnClick
|
||||
end
|
||||
object NotifySinksBtn: TButton
|
||||
Left = 0
|
||||
Top = 84
|
||||
Width = 226
|
||||
Height = 27
|
||||
Align = alBottom
|
||||
Caption = 'Notify sinks'
|
||||
TabOrder = 1
|
||||
OnClick = NotifySinksBtnClick
|
||||
ExplicitTop = 47
|
||||
end
|
||||
object CreateRouteBtn: TButton
|
||||
Left = 0
|
||||
Top = 10
|
||||
@@ -78,18 +100,9 @@ object MediaRouterFrm: TMediaRouterFrm
|
||||
Align = alTop
|
||||
Caption = 'Create route'
|
||||
Enabled = False
|
||||
TabOrder = 0
|
||||
TabOrder = 2
|
||||
OnClick = CreateRouteBtnClick
|
||||
end
|
||||
object NotifySinksBtn: TButton
|
||||
Left = 0
|
||||
Top = 47
|
||||
Width = 226
|
||||
Height = 27
|
||||
Align = alBottom
|
||||
Caption = 'Notify sinks'
|
||||
TabOrder = 1
|
||||
OnClick = NotifySinksBtnClick
|
||||
ExplicitTop = 18
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -125,11 +138,13 @@ object MediaRouterFrm: TMediaRouterFrm
|
||||
object SourceURNLbl: TLabel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 57
|
||||
Height = 13
|
||||
Width = 65
|
||||
Height = 21
|
||||
Align = alClient
|
||||
Caption = 'Source URN'
|
||||
Layout = tlCenter
|
||||
ExplicitWidth = 57
|
||||
ExplicitHeight = 13
|
||||
end
|
||||
end
|
||||
object SourceURNCbx: TComboBox
|
||||
@@ -300,6 +315,7 @@ object MediaRouterFrm: TMediaRouterFrm
|
||||
end
|
||||
object Chromium1: TChromium
|
||||
OnMediaRouteCreateFinished = Chromium1MediaRouteCreateFinished
|
||||
OnMediaSinkDeviceInfo = Chromium1MediaSinkDeviceInfo
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
|
@@ -69,7 +69,7 @@ type
|
||||
SinksGbx: TGroupBox;
|
||||
SinksLbx: TListBox;
|
||||
SinksButtonsPnl: TPanel;
|
||||
CreateRouteBtn: TButton;
|
||||
GetDeviceInfoBtn: TButton;
|
||||
CentralPnl: TPanel;
|
||||
SourcePnl: TPanel;
|
||||
SourceLblPnl: TPanel;
|
||||
@@ -90,6 +90,7 @@ type
|
||||
ClearLogPnl: TPanel;
|
||||
ClearLogBtn: TButton;
|
||||
SourceURNCbx: TComboBox;
|
||||
CreateRouteBtn: TButton;
|
||||
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
@@ -104,11 +105,12 @@ type
|
||||
procedure Chromium1RouteStateChanged(Sender: TObject; const route: ICefMediaRoute; state: TCefMediaRouteConnectionState);
|
||||
procedure Chromium1RouteMessageReceived(Sender: TObject; const route: ICefMediaRoute; const message_: ustring);
|
||||
procedure Chromium1MediaRouteCreateFinished(Sender: TObject; result: Integer; const error: ustring; const route: ICefMediaRoute);
|
||||
procedure Chromium1MediaSinkDeviceInfo(Sender: TObject; const ip_address: ustring; port: Integer; const model_name: ustring);
|
||||
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
procedure SourceURNEdtChange(Sender: TObject);
|
||||
procedure SinksLbxClick(Sender: TObject);
|
||||
procedure CreateRouteBtnClick(Sender: TObject);
|
||||
procedure GetDeviceInfoBtnClick(Sender: TObject);
|
||||
procedure TerminateRouteBtnClick(Sender: TObject);
|
||||
procedure SendMsgBtnClick(Sender: TObject);
|
||||
procedure NotifySinksBtnClick(Sender: TObject);
|
||||
@@ -116,6 +118,7 @@ type
|
||||
procedure ClearLogBtnClick(Sender: TObject);
|
||||
procedure MessageMemChange(Sender: TObject);
|
||||
procedure RoutesLbxClick(Sender: TObject);
|
||||
procedure CreateRouteBtnClick(Sender: TObject);
|
||||
|
||||
protected
|
||||
// Variables to control when can we destroy the form safely
|
||||
@@ -265,6 +268,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.Chromium1MediaSinkDeviceInfo(Sender: TObject;
|
||||
const ip_address: ustring; port: Integer; const model_name: ustring);
|
||||
begin
|
||||
try
|
||||
FMediaCS.Acquire;
|
||||
FLog.Add('Sink device info');
|
||||
FLog.Add('IP address : ' + ip_address);
|
||||
FLog.Add('Port : ' + inttostr(port));
|
||||
FLog.Add('Model name : ' + model_name);
|
||||
FLog.Add('------------------------------------------');
|
||||
finally
|
||||
PostMessage(Handle, MEDIA_ROUTER_PENDING_LOG_LINES, 0, 0);
|
||||
FMediaCS.Release;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.Chromium1RouteMessageReceived(Sender: TObject;
|
||||
const route: ICefMediaRoute; const message_: ustring);
|
||||
var
|
||||
@@ -323,6 +342,8 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
DestroyAllArrays;
|
||||
Chromium1.ExecuteDevToolsMethod(0, 'Cast.disable', nil);
|
||||
sleep(500);
|
||||
Chromium1.CloseBrowser(True);
|
||||
end;
|
||||
end;
|
||||
@@ -546,6 +567,64 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.CreateRouteBtnClick(Sender: TObject);
|
||||
var
|
||||
TempURN, TempErrorMsg : string;
|
||||
TempSource : ICefMediaSource;
|
||||
begin
|
||||
TempURN := trim(SourceURNCbx.Text);
|
||||
|
||||
if (length(TempURN) = 0) then
|
||||
begin
|
||||
AddLogEntry('Invalid URN');
|
||||
exit;
|
||||
end;
|
||||
|
||||
TempErrorMsg := '';
|
||||
|
||||
try
|
||||
try
|
||||
FMediaCS.Acquire;
|
||||
|
||||
if (FSinks <> nil) and
|
||||
(SinksLbx.Items.Count > 0) and
|
||||
(SinksLbx.ItemIndex >= 0) and
|
||||
(SinksLbx.ItemIndex < length(FSinks)) then
|
||||
begin
|
||||
TempSource := Chromium1.GetSource(TempURN);
|
||||
|
||||
if (TempSource <> nil) and TempSource.IsValid then
|
||||
begin
|
||||
if (FSinks[SinksLbx.ItemIndex].SinkIntf <> nil) and
|
||||
FSinks[SinksLbx.ItemIndex].SinkIntf.IsValid then
|
||||
begin
|
||||
if FSinks[SinksLbx.ItemIndex].SinkIntf.IsCompatibleWith(TempSource) then
|
||||
Chromium1.CreateRoute(TempSource, FSinks[SinksLbx.ItemIndex].SinkIntf)
|
||||
else
|
||||
TempErrorMsg := 'The selected Sink is not compatible with the Media Source.';
|
||||
end
|
||||
else
|
||||
TempErrorMsg := 'The selected Sink is not valid.';
|
||||
end
|
||||
else
|
||||
TempErrorMsg := 'The Media Source is not valid.';
|
||||
end
|
||||
else
|
||||
TempErrorMsg := 'The sinks list is outdated.';
|
||||
except
|
||||
on e : exception do
|
||||
begin
|
||||
TempErrorMsg := e.Message;
|
||||
if CustomExceptionHandler('TMediaRouterFrm.CreateRouteBtnClick', e) then raise;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
TempSource := nil;
|
||||
FMediaCS.Release;
|
||||
if (length(TempErrorMsg) > 0) then AddLogEntry(TempErrorMsg);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.CopySinksArray(const aSinks : TCefMediaSinkArray);
|
||||
var
|
||||
i, TempLen : integer;
|
||||
@@ -623,61 +702,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.CreateRouteBtnClick(Sender: TObject);
|
||||
var
|
||||
TempURN, TempErrorMsg : string;
|
||||
TempSource : ICefMediaSource;
|
||||
procedure TMediaRouterFrm.GetDeviceInfoBtnClick(Sender: TObject);
|
||||
begin
|
||||
TempURN := trim(SourceURNCbx.Text);
|
||||
|
||||
if (length(TempURN) = 0) then
|
||||
begin
|
||||
AddLogEntry('Invalid URN');
|
||||
exit;
|
||||
end;
|
||||
|
||||
TempErrorMsg := '';
|
||||
|
||||
try
|
||||
try
|
||||
FMediaCS.Acquire;
|
||||
FMediaCS.Acquire;
|
||||
|
||||
if (FSinks <> nil) and
|
||||
(SinksLbx.Items.Count > 0) and
|
||||
(SinksLbx.ItemIndex >= 0) and
|
||||
(SinksLbx.ItemIndex < length(FSinks)) then
|
||||
begin
|
||||
TempSource := Chromium1.GetSource(TempURN);
|
||||
|
||||
if (TempSource <> nil) and TempSource.IsValid then
|
||||
begin
|
||||
if (FSinks[SinksLbx.ItemIndex].SinkIntf <> nil) and
|
||||
FSinks[SinksLbx.ItemIndex].SinkIntf.IsValid then
|
||||
begin
|
||||
if FSinks[SinksLbx.ItemIndex].SinkIntf.IsCompatibleWith(TempSource) then
|
||||
Chromium1.CreateRoute(TempSource, FSinks[SinksLbx.ItemIndex].SinkIntf)
|
||||
else
|
||||
TempErrorMsg := 'The selected Sink is not compatible with the Media Source.';
|
||||
end
|
||||
else
|
||||
TempErrorMsg := 'The selected Sink is not valid.';
|
||||
end
|
||||
else
|
||||
TempErrorMsg := 'The Media Source is not valid.';
|
||||
end
|
||||
else
|
||||
TempErrorMsg := 'The sinks list is outdated.';
|
||||
except
|
||||
on e : exception do
|
||||
begin
|
||||
TempErrorMsg := e.Message;
|
||||
if CustomExceptionHandler('TMediaRouterFrm.CreateRouteBtnClick', e) then raise;
|
||||
end;
|
||||
end;
|
||||
if (FSinks <> nil) and
|
||||
(SinksLbx.Items.Count > 0) and
|
||||
(SinksLbx.ItemIndex >= 0) and
|
||||
(SinksLbx.ItemIndex < length(FSinks)) then
|
||||
Chromium1.GetDeviceInfo(FSinks[SinksLbx.ItemIndex].SinkIntf);
|
||||
finally
|
||||
TempSource := nil;
|
||||
FMediaCS.Release;
|
||||
if (length(TempErrorMsg) > 0) then AddLogEntry(TempErrorMsg);
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -754,10 +790,12 @@ begin
|
||||
SendMsgBtn.Enabled := TerminateRouteBtn.Enabled and
|
||||
(length(trim(MessageMem.Lines.Text)) > 0);
|
||||
|
||||
GetDeviceInfoBtn.Enabled := (SinksLbx.ItemIndex >= 0) and
|
||||
(SinksLbx.Items.Count > 0);
|
||||
|
||||
CreateRouteBtn.Enabled := not(TerminateRouteBtn.Enabled) and
|
||||
(length(trim(SourceURNCbx.Text)) > 0) and
|
||||
(SinksLbx.ItemIndex >= 0) and
|
||||
(SinksLbx.Items.Count > 0);
|
||||
GetDeviceInfoBtn.Enabled and
|
||||
(length(trim(SourceURNCbx.Text)) > 0);
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.AddLogEntry(const aMessage1, aMessage2 : string; aRec : boolean);
|
||||
|
Reference in New Issue
Block a user