Skip to content

Commit

Permalink
feat(FEC-13250): add new player events (#811)
Browse files Browse the repository at this point in the history

* FEC-13250 add new player events
VIDEO_TRACKS_ENABLED
VIDEO_TRACKS_DISABLED

Example:
       player.addListener(this, PlayerEvent.videoTracksDisabled, event -> {
            log.d("videoTracksDisabled");
        });

        player.addListener(this, PlayerEvent.videoTracksEnabled, event -> {
            log.d("videoTracksEnabled");
        });
  • Loading branch information
giladna committed Jun 26, 2023
1 parent a19715a commit 61e3fc2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions playkit/src/main/java/com/kaltura/playkit/PlayerEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public class PlayerEvent implements PKEvent {
public static final PlayerEvent.Type seeked = Type.SEEKED;
public static final PlayerEvent.Type replay = Type.REPLAY;
public static final PlayerEvent.Type stopped = Type.STOPPED;
public static final PlayerEvent.Type videoTracksEnabled = Type.VIDEO_TRACKS_ENABLED;
public static final PlayerEvent.Type videoTracksDisabled = Type.VIDEO_TRACKS_DISABLED;



public final Type type;

Expand Down Expand Up @@ -396,6 +400,8 @@ public enum Type {
CONNECTION_ACQUIRED,
VIDEO_FRAMES_DROPPED, // Video frames were dropped, see PlayerEvent.VideoFramesDropped.
OUTPUT_BUFFER_COUNT_UPDATE,
VIDEO_TRACKS_ENABLED,
VIDEO_TRACKS_DISABLED,
BYTES_LOADED, // Bytes were downloaded from the network.
SUBTITLE_STYLE_CHANGED, // Subtitle style is changed.
ASPECT_RATIO_RESIZE_MODE_CHANGED, //Send when updating the Surface Vide Aspect Ratio size mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ public void onVideoDisabled(@NonNull EventTime eventTime, DecoderCounters decode
renderedOutputBufferCount = decoderCounters.renderedOutputBufferCount;
if (listener != null) {
listener.onDecoderDisabled(skippedOutputBufferCount, renderedOutputBufferCount);
listener.onVideoDisabled();
}
}

@Override
public void onVideoEnabled(EventTime eventTime, DecoderCounters decoderCounters) {
if (listener != null) {
listener.onVideoEnabled();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,20 @@ public void onDecoderDisabled(int skippedOutputBufferCount, int renderedOutputBu
}
}

@Override
public void onVideoDisabled() {
if (eventListener != null) {
eventListener.onEvent(new PlayerEvent(PlayerEvent.videoTracksDisabled));
}
}

@Override
public void onVideoEnabled() {
if (eventListener != null) {
eventListener.onEvent(new PlayerEvent(PlayerEvent.videoTracksEnabled));
}
}

@Override
public void onManifestRedirected(String redirectedUrl) {
boolean isNewRedirectUrl = !TextUtils.equals(lastRedirectedUrl, redirectedUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ interface AnalyticsListener {
void onConnectionAcquired(URIConnectionAcquiredInfo uriConnectionAcquiredInfo);
void onLoadError(IOException error, boolean wasCanceled);
void onDecoderDisabled(int skippedOutputBufferCount, int renderedOutputBufferCount);
void onVideoDisabled();
void onVideoEnabled();
void onManifestRedirected(String redirectedManifestUrl);
}
}

0 comments on commit 61e3fc2

Please sign in to comment.