Skip to content

Commit

Permalink
v2.5.4 (#159)
Browse files Browse the repository at this point in the history
### Fixes
 - Reverts audio test improvements introduced in v2.5.3. (#158)
  • Loading branch information
skidder authored Sep 22, 2021
1 parent 161db4a commit dba3fc9
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 155 deletions.
2 changes: 1 addition & 1 deletion MuxExoPlayer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android {
defaultConfig {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
versionCode 30
versionCode 31
versionName project.ext.versionName
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ protected void play() {
* {@link PlayerState#PLAYING}
*/
protected void playing() {
if (seekingInProgress || state == PlayerState.PLAYING) {
if (seekingInProgress) {
// We will dispatch playing event after seeked event
return;
}
Expand Down
4 changes: 4 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release notes

## v2.5.4
### Fixes
- Reverts audio test improvements introduced in v2.5.3. (#158)

## v2.5.3
### Improvements
- Upgrade Docker base image used for builds to JDK 8u302 (#155)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ public class AudioPlaybackTests extends SeekingTestBase {

@Before
public void init() {
bandwidthLimitInBitsPerSecond = 150000;
urlToPlay = "http://localhost:5000/audio.mp4";
urlToPlay = "http://localhost:5000/audio.aac";
super.init();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,99 @@ public void run() {
}
}

/*
* According to the self validation guid: https://docs.google.com/document/d/1FU_09N3Cg9xfh784edBJpgg3YVhzBA6-bd5XHLK7IK4/edit#
* We are implementing vod playback scenario.
*/
@Test
public void testVodPlayback() {
try {
if (!testActivity.waitForPlaybackToStart(waitForPlaybackToStartInMS)) {
fail("Playback did not start in " + waitForPlaybackToStartInMS + " milliseconds !!!");
}

// Init player controlls
controlView = pView.findViewById(R.id.exo_controller);
if (controlView != null) {
pauseButton = controlView.findViewById(R.id.exo_pause);
playButton = controlView.findViewById(R.id.exo_play);
}
initPlayerControls();

// play x seconds, stage 1
Thread.sleep(PLAY_PERIOD_IN_MS);
pausePlayer();
// Pause x seconds, stage 2
Thread.sleep(PAUSE_PERIOD_IN_MS);
// Resume video, stage 3
resumePlayer();
// Play another x seconds
Thread.sleep(PLAY_PERIOD_IN_MS);

// Seek backward, stage 4
testActivity.runOnUiThread(new Runnable() {
public void run() {
long currentPlaybackPosition = pView.getPlayer().getCurrentPosition();
pView.getPlayer().seekTo(currentPlaybackPosition / 2);
}
});

// Play another x seconds, stage 5
Thread.sleep(PLAY_PERIOD_IN_MS);

// seek forward in the video, stage 6
testActivity.runOnUiThread(new Runnable() {
public void run() {
long currentPlaybackPosition = pView.getPlayer()
.getCurrentPosition();
long videoDuration = pView.getPlayer().getDuration();
long seekToInFuture =
currentPlaybackPosition + ((videoDuration - currentPlaybackPosition) / 2);
pView.getPlayer().seekTo(seekToInFuture);
}
});
Thread.sleep(PLAY_PERIOD_IN_MS);
testActivity.runOnUiThread(new Runnable() {
public void run() {
pView.getPlayer().stop();
}
});

// Play another x seconds, stage 7
Thread.sleep(PLAY_PERIOD_IN_MS);

CheckupResult result;

// Check first playback period, stage 1
result = checkPlaybackPeriodAtIndex(0, PLAY_PERIOD_IN_MS);

// Check pause period, stage 2
result = checkPausePeriodAtIndex(result.eventIndex, PAUSE_PERIOD_IN_MS);

// Check playback period, stage 3
result = checkPlaybackPeriodAtIndex(result.eventIndex - 1, PLAY_PERIOD_IN_MS);

// Check SeekEvents, stage 4
result = checkSeekAtIndex(result.eventIndex);

// check playback period stage 5
result = checkPlaybackPeriodAtIndex(result.eventIndex,
PLAY_PERIOD_IN_MS - result.seekPeriod);

// check seeking, stage 6
result = checkSeekAtIndex(result.eventIndex);
int pauseEventIndex = networkRequest.getIndexForNextEvent(result.eventIndex, PauseEvent.TYPE);
if (pauseEventIndex == -1) {
fail("Missing pause event");
}
Log.w(TAG, "See what event should be dispatched on view closed !!!");
checkFullScreenValue();
} catch (Exception e) {
fail(getExceptionFullTraceAndMessage(e));
}
Log.e(TAG, "All done !!!");
}

@Test
public void testRebufferingAndStartupTime() {
try {
Expand Down Expand Up @@ -200,4 +293,25 @@ public void testRebufferingAndStartupTime() {
fail(getExceptionFullTraceAndMessage(e));
}
}

void initPlayerControls() {
controlView = pView.findViewById(R.id.exo_controller);
if (controlView != null) {
pauseButton = controlView.findViewById(R.id.exo_pause);
playButton = controlView.findViewById(R.id.exo_play);
}
}

void checkFullScreenValue() throws JSONException {
JSONArray events = networkRequest.getReceivedEventsAsJSON();
for (int i = 0; i < events.length(); i++) {
JSONObject event = events.getJSONObject(i);
if (event.has(PlayerData.PLAYER_IS_FULLSCREEN)) {
assertEquals("Expected player to be in full screen !!!",
true, event.getBoolean(PlayerData.PLAYER_IS_FULLSCREEN));
return;
}
}
fail("PlayerData.PLAYER_IS_FULLSCREEN field not present, this is an error !!!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,41 @@ public class RunInBackgroundTests extends TestBase {

@Before
public void init() {
urlToPlay = "http://localhost:5000/audio.mp4";
urlToPlay = "http://localhost:5000/audio.aac";
super.init();
}

@Test
public void testAudioVodPlaybackInBackground() {
testVodPlayback(true,10000, 72000);
public void testBackgroundAudioPlayback() {
try {
testActivity.waitForActivityToInitialize();
backgroundActivity();
testActivity.waitForPlaybackToStart(waitForPlaybackToStartInMS);
Thread.sleep(PLAY_PERIOD_IN_MS);
int playingEventIndex = networkRequest.getIndexForFirstEvent(PlayingEvent.TYPE);
if (playingEventIndex == -1) {
fail("Playing event missing ! Received : " + networkRequest.getReceivedEventNames());
}
int playEventIndex = networkRequest.getIndexForFirstEvent(PlayEvent.TYPE);
if (playEventIndex == -1) {
fail("Play event missing ! Received : " + networkRequest.getReceivedEventNames());
}
if (playEventIndex > playingEventIndex) {
fail("Play event came after Playing event ! Received : " + networkRequest
.getReceivedEventNames());
}
int rebufferEventIndex = networkRequest.getIndexForFirstEvent(RebufferStartEvent.TYPE);
if (rebufferEventIndex != -1) {
fail("Got rebuffer event on a smooth playback ! Received : " + networkRequest
.getReceivedEventNames());
}
long timeDiff = networkRequest.getCreationTimeForEvent(playEventIndex) -
networkRequest.getCreationTimeForEvent(playingEventIndex);
if (timeDiff > 500) {
fail("Playing event is more then 500 ms apart from play event !!!");
}
} catch (Exception e) {
fail(getExceptionFullTraceAndMessage(e));
}
}
}
Loading

0 comments on commit dba3fc9

Please sign in to comment.