Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

ALL-3936/Internal package #59

Merged
merged 8 commits into from
Jun 29, 2017
Merged

ALL-3936/Internal package #59

merged 8 commits into from
Jun 29, 2017

Conversation

Mecharyry
Copy link
Contributor

@Mecharyry Mecharyry commented Jun 28, 2017

Problem

As per the discussion in #58 we want to expose an internal package for classes that we are forced to make public but should not be used by clients and therefore do not require JavaDocs.

Solution

Create an internal package and move internally public classes there!

Replace the getters for ErrorListeners etc in the ListenersHolder so that they use the interface rather than the implementation. Allows us to make those implementations package protected so that the only way to add and remove is through the ListenersHolder.

Remove generics on the Heartbeat.Callbacks we always need a Player anyway.

Add the Heartbeat.Callback to the Player because that's where all the other Callbacks and Listeners are always declared here.

Test(s) added

No, just updating the broken packages.

Screenshots

No UI changes.

Paired with

@ouchadam

@Mecharyry Mecharyry changed the base branch from master to exo-player-2 June 28, 2017 14:30
@juankysoriano juankysoriano self-requested a review June 28, 2017 14:31
@juankysoriano juankysoriano self-assigned this Jun 28, 2017

import java.util.List;
import java.util.Map;

public interface Player extends PlayerState {



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooops

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@juankysoriano juankysoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More red than green, and I have seen a few classes with reduced scope. LGTM

@jszmltr jszmltr self-assigned this Jun 28, 2017
@jszmltr jszmltr self-requested a review June 28, 2017 14:51
@@ -30,9 +30,9 @@

void removeBitrateChangedListener(Player.BitrateChangedListener bitrateChangedListener);

void addHeartbeatCallback(Heart.Heartbeat.Callback<Player> callback);
void addHeartbeatCallback(Player.HeartbeatCallback heartbeatCallback);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heart.Heartbeat.Callback has been moved to the Player to match the other listeners that the Player supports.

DrmSessionCreator drmSessionCreator = drmSessionCreatorFactory.createFor(drmType, drmHandler);
return noPlayerExoPlayerCreator.createExoPlayer(context, drmSessionCreator, downgradeSecureDecoder);
} catch (DrmSessionCreatorException exception) {
throw new UnableToCreatePlayerException(exception);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mapping an internal exception to a public facing exception.

@@ -225,4 +224,9 @@ public void onLoadTimeout() {

void onLoadTimeout();
}

interface HeartbeatCallback {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from Heart.Heartbeat.Callback to match the other callbacks on the Player.

@@ -3,4 +3,23 @@
public interface StreamingModularDrm extends DrmHandler {

byte[] executeKeyRequest(ModularDrmKeyRequest request) throws DrmRequestException;

final class DrmRequestException extends Exception {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only used for StreamingModularDrm so inlined on the interface.

@@ -63,24 +65,19 @@ public boolean isBeating() {
return beating;
}

public static class Heartbeat<T> implements Runnable {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the generic, we always pass back a Player.


import java.util.HashMap;

class EventInfoForwarder implements ExoPlayer.EventListener {

private final InfoListeners infoListeners;
private final Player.InfoListener infoListener;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coding to the exposed interface rather than the internal class.

@@ -125,39 +119,39 @@ public void removeVideoSizeChangedListener(Player.VideoSizeChangedListener video
videoSizeChangedListeners.remove(videoSizeChangedListener);
}

public ErrorListeners getErrorListeners() {
public Player.ErrorListener getErrorListeners() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the interfaces, so that we can make the ErrorListeners etc package protected.

@@ -0,0 +1,7 @@
package com.novoda.noplayer.internal.exoplayer.mediasource;

enum TrackType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this coming from ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just moved from exoplayer.mediasource to internal.exoplayer.mediasource.

@@ -180,7 +180,7 @@ public void seekTo(VideoPosition position) throws IllegalStateException {
}

@Override
public void pause() { // TODO: throw to match ExoPlayer?
public void pause() throws IllegalStateException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

import com.novoda.noplayer.Player;
import com.novoda.noplayer.internal.mediaplayer.CheckBufferHeartbeatCallback;

class BufferHeartbeatListener implements CheckBufferHeartbeatCallback.BufferListener {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this moved from somewhere else as well ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was in the mediaplayer.forwarder package before. Now it's been moved to internal.mediaplayer.forwarder.

@jszmltr jszmltr merged commit 898c024 into exo-player-2 Jun 29, 2017
@jszmltr jszmltr deleted the ALL-3936/internal branch June 29, 2017 07:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants