1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.google.android.exoplayer2.drm; 17 18 import com.google.android.exoplayer2.Player; 19 20 /** Listener of {@link DrmSessionManager} events. */ 21 public interface DrmSessionEventListener { 22 23 /** Called each time a drm session is acquired. */ onDrmSessionAcquired()24 default void onDrmSessionAcquired() {} 25 26 /** Called each time keys are loaded. */ onDrmKeysLoaded()27 default void onDrmKeysLoaded() {} 28 29 /** 30 * Called when a drm error occurs. 31 * 32 * <p>This method being called does not indicate that playback has failed, or that it will fail. 33 * The player may be able to recover from the error and continue. Hence applications should 34 * <em>not</em> implement this method to display a user visible error or initiate an application 35 * level retry ({@link Player.EventListener#onPlayerError} is the appropriate place to implement 36 * such behavior). This method is called to provide the application with an opportunity to log the 37 * error if it wishes to do so. 38 * 39 * @param error The corresponding exception. 40 */ onDrmSessionManagerError(Exception error)41 default void onDrmSessionManagerError(Exception error) {} 42 43 /** Called each time offline keys are restored. */ onDrmKeysRestored()44 default void onDrmKeysRestored() {} 45 46 /** Called each time offline keys are removed. */ onDrmKeysRemoved()47 default void onDrmKeysRemoved() {} 48 49 /** Called each time a drm session is released. */ onDrmSessionReleased()50 default void onDrmSessionReleased() {} 51 } 52