【问题标题】:Mute/stop video running in background (Delphi - Android App)静音/停止在后台运行的视频(Delphi - Android 应用程序)
【发布时间】:2021-12-29 06:04:10
【问题描述】:

我在 Delphi 中有一个播放视频的应用程序。当我打开另一个应用程序但屏幕空白时,我一直听到视频声音。 如何检测到屏幕已黑屏,或已切换到另一个应用程序?

【问题讨论】:

    标签: android delphi firemonkey


    【解决方案1】:

    我找到了解决办法。

    uses FMX.Platform;
    
    procedure TMyForm.FormCreate(Sender: TObject);
    var
    AppEventSvc:IFMXApplicationEventService;
    begin
    if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService,IInterface(AppEventSvc)) then
    begin
    AppEventSvc.SetApplicationEventHandler(AppEvent);
    end;
    end;
    
    function TMyForm.AppEvent(AAppEvent:TApplicationEvent;AContext:TObject):Boolean;
    begin
    if AAppEvent=TApplicationEvent.WillTerminate then
    begin
    // Do soomething
    end;
    Result:=True;
    end;
    

    【讨论】:

      猜你喜欢
      • 2017-12-03
      • 1970-01-01
      • 2014-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多