Einzelnen Beitrag anzeigen

CHackbart

Registriert seit: 22. Okt 2012
267 Beiträge
 
#3

AW: Fairplay Apple

  Alt 5. Aug 2021, 14:31
Nachtrag,

du musst dann bei der Wiedergabe dein AVUrlAsset zu deiner AVContentKeySession via addContentKeyRecipient übergeben. Zumindest in der Theorie. In der Praxis gibt es 2 Probleme:

Wenn ich

procedure contentKeySession(session: AVContentKeySession; keyRequest: AVPersistableContentKeyRequest); overload; cdecl; in AVContentKeySessionDelegate behalte, crasht die Anwendung sobald ich FContentKeyDelegate := TContentKeyDelegate.Create; ausführe. Ich habe keine Ahnung woran das liegen kann, ist eventuell ein Bug. Vielleicht kann das ja jemand reproduzieren?

Delphi-Quellcode:
 
type
  AVContentKeySessionDelegate = interface(IObjectiveC)
    ['{3066C8DB-B31C-4339-A49D-912BA193660C}']
    procedure contentKeySession(session: AVContentKeySession; persistableContentKey: NSData; keyIdentifier: Pointer); overload; cdecl;
    procedure contentKeySession(session: AVContentKeySession; keyRequest: AVContentKeyRequest; err: NSError); overload; cdecl;
    function contentKeySession(session: AVContentKeySession; keyRequest: AVContentKeyRequest;
      retryReason: AVContentKeyRequestRetryReason): Boolean; overload; cdecl;
    procedure contentKeySession(session: AVContentKeySession; keyRequest: AVContentKeyRequest); overload; cdecl;

    procedure contentKeySession(session: AVContentKeySession; keyRequest: AVPersistableContentKeyRequest); overload; cdecl;
    procedure contentKeySessionContentKeyRequestDidSucceed(session: AVContentKeySession; keyRequest: AVContentKeyRequest); cdecl;
    procedure contentKeySessionContentProtectionSessionIdentifierDidChange(session: AVContentKeySession); cdecl;
    procedure contentKeySessionDidGenerateExpiredSessionReport(session: AVContentKeySession); cdecl;
    procedure contentKeySessionDidProvideRenewingContentKeyRequest(session: AVContentKeySession; keyRequest: AVContentKeyRequest); cdecl;
  end;

  TContentKeyDelegate = class(TOCLocal, AVContentKeySessionDelegate)
  public
    procedure contentKeySession(session: AVContentKeySession;
      persistableContentKey: NSData; keyIdentifier: Pointer); overload; cdecl;
    procedure contentKeySession(session: AVContentKeySession;
      keyRequest: AVContentKeyRequest; err: NSError); overload; cdecl;
    function contentKeySession(session: AVContentKeySession;
      keyRequest: AVContentKeyRequest;
      retryReason: AVContentKeyRequestRetryReason): Boolean; overload; cdecl;
    procedure contentKeySession(session: AVContentKeySession;
      keyRequest: AVContentKeyRequest); overload; cdecl;
    procedure contentKeySession(session: AVContentKeySession;
      keyRequest: AVPersistableContentKeyRequest); overload; cdecl;
    procedure contentKeySessionContentKeyRequestDidSucceed
      (session: AVContentKeySession; keyRequest: AVContentKeyRequest); cdecl;
    procedure contentKeySessionContentProtectionSessionIdentifierDidChange
      (session: AVContentKeySession); cdecl;
    procedure contentKeySessionDidGenerateExpiredSessionReport
      (session: AVContentKeySession); cdecl;
    procedure contentKeySessionDidProvideRenewingContentKeyRequest
      (session: AVContentKeySession; keyRequest: AVContentKeyRequest); cdecl;
  end;

{ TContentKeyDelegate }

procedure TContentKeyDelegate.contentKeySession(session: AVContentKeySession;
  persistableContentKey: NSData; keyIdentifier: Pointer);
begin
end;

procedure TContentKeyDelegate.contentKeySession(session: AVContentKeySession;
  keyRequest: AVContentKeyRequest; err: NSError);
begin
end;

function TContentKeyDelegate.contentKeySession(session: AVContentKeySession;
  keyRequest: AVContentKeyRequest;
  retryReason: AVContentKeyRequestRetryReason): Boolean;
begin
  result := false;
end;

procedure TContentKeyDelegate.contentKeySession(session: AVContentKeySession;
  keyRequest: AVContentKeyRequest);
begin
end;

procedure TContentKeyDelegate.contentKeySession(session: AVContentKeySession;
  keyRequest: AVPersistableContentKeyRequest);
begin
end;

procedure TContentKeyDelegate.contentKeySessionContentKeyRequestDidSucceed
  (session: AVContentKeySession; keyRequest: AVContentKeyRequest);
begin
end;

procedure TContentKeyDelegate.
  contentKeySessionContentProtectionSessionIdentifierDidChange
  (session: AVContentKeySession);
begin
end;

procedure TContentKeyDelegate.contentKeySessionDidGenerateExpiredSessionReport
  (session: AVContentKeySession);
begin
end;

procedure TContentKeyDelegate.
  contentKeySessionDidProvideRenewingContentKeyRequest
  (session: AVContentKeySession; keyRequest: AVContentKeyRequest);
begin
end;

...
FContentKeyDelegate := TContentKeyDelegate.Create;
Das andere Problem ist ein SigSev 6 sobald man das asset übergibt. Aber das liegt eher an der Testimplementierung hier.
  Mit Zitat antworten Zitat