public void SessionUpdate(string sessionId, string responseText) { Status status; lock (cdmInstanceLock) { if (!sessionsByIds.ContainsKey(sessionId)) { throw new DrmException($"Cannot update session {sessionId}."); } try { status = cdmInstance.session_update(sessionId, responseText); } catch (Exception e) { throw new DrmException($"{EmeStatusConverter.Convert(Status.kUnexpectedError)} - Exception message: {e.Message}"); } } Logger.Info($"Install MediaKeySession {sessionId} result: {status}"); if (status != Status.kSuccess) { Logger.Error($"License Installation failure {EmeStatusConverter.Convert(status)}"); throw new DrmException(EmeStatusConverter.Convert(status)); } }
public string CreateSession() { string sessionId = null; var status = cdmInstance.session_create(SessionType.kTemporary, ref sessionId); if (status != Status.kSuccess) { throw new DrmException(EmeStatusConverter.Convert(status)); } Logger.Info($"Created session: {sessionId}"); return(sessionId); }
private void GenerateRequest(string sessionId, DrmInitData initData) { if (initData.InitData == null) { throw new DrmException(ErrorMessage.InvalidArgument); } lock (cdmInstanceLock) { if (!sessionsByIds.ContainsKey(sessionId)) { throw new DrmException($"Cannot generate request for session {sessionId}."); } var status = cdmInstance.session_generateRequest(sessionId, InitDataType.kCenc, Encoding.GetEncoding(437).GetString(initData.InitData)); if (status != Status.kSuccess) { throw new DrmException(EmeStatusConverter.Convert(status)); } } }