Skip to content

Commit

Permalink
v2.4.8 (#108)
Browse files Browse the repository at this point in the history
* reset state when calling videochange (#107)

* reset state when calling videochange

* Added automated test for video channge and program change.

* minor update to prevent programChange hb's not working

* Reformat code and remove commented-out test code.

Co-authored-by: Tomislav Kordic <[email protected]>
Co-authored-by: Scott Kidder <[email protected]>

* v2.4.8

* More detailed change-description in the release notes.

Co-authored-by: James Williams <[email protected]>
Co-authored-by: Tomislav Kordic <[email protected]>
  • Loading branch information
3 people authored Apr 16, 2021
1 parent 228d922 commit 56a11c7
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 2 deletions.
4 changes: 2 additions & 2 deletions MuxExoPlayer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ android {
defaultConfig {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
versionCode 18
versionName "2.4.7"
versionCode 19
versionName "2.4.8"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ public void enableMuxCoreDebug(boolean enable, boolean verbose) {

@SuppressWarnings("unused")
public void videoChange(CustomerVideoData customerVideoData) {
// Reset the state to avoid unwanted rebuffering events
state = PlayerState.INIT;
resetInternalStats();
muxStats.videoChange(customerVideoData);
}
Expand Down
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release notes

## v2.4.8
- Reset internal state when calling videochange, fixing an issue where rebuffering may be reported incorrectly after calling videochange. (#107)

## v2.4.7
- Use playWhenReady and playbackStartPosition in Exoplayer r2.13 test. (#105)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import com.mux.stats.sdk.core.events.playback.RebufferStartEvent;
import com.mux.stats.sdk.core.events.playback.ViewEndEvent;
import com.mux.stats.sdk.core.events.playback.ViewStartEvent;
import com.mux.stats.sdk.core.model.CustomerVideoData;
import com.mux.stats.sdk.muxstats.MuxStatsExoPlayer;
import com.mux.stats.sdk.muxstats.R;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -25,6 +27,58 @@
public class PlaybackTests extends TestBase {

public static final String TAG = "playbackTest";
static final String secondVideoToPlayUrl = "http://localhost:5000/hls/google_glass/playlist.m3u8";

@Test
public void testVideoChange() {
testVideoChange(false, true);
}

@Test
public void testProgramChange() {
testVideoChange(true, false);
}

public void testVideoChange(boolean programChange, boolean videoChange) {
try {
if (!testActivity.waitForPlaybackToStart(waitForPlaybackToStartInMS)) {
fail("Playback did not start in " + waitForPlaybackToStartInMS + " milliseconds !!!");
}
Thread.sleep(PAUSE_PERIOD_IN_MS);
// Video started, do video change, we expect to see fake rebufferstart
testActivity.runOnUiThread(new Runnable() {
public void run() {
testActivity.setUrlToPlay(secondVideoToPlayUrl);
CustomerVideoData customerVideoData = new CustomerVideoData();
customerVideoData.setVideoTitle(BuildConfig.FLAVOR + "-" + currentTestName.getMethodName()
+ "_title_2");
MuxStatsExoPlayer muxStats = testActivity.getMuxStats();
if (videoChange) {
muxStats.videoChange(customerVideoData);
}
if (programChange) {
muxStats.programChange(customerVideoData);
}
testActivity.startPlayback();
}
});
Thread.sleep(PAUSE_PERIOD_IN_MS);
int rebufferStartEventIndex = 0;
int rebufferEndEventIndex;
while ((rebufferStartEventIndex = networkRequest.getIndexForNextEvent(
rebufferStartEventIndex, RebufferStartEvent.TYPE)) != -1) {
rebufferEndEventIndex = networkRequest.getIndexForNextEvent(rebufferStartEventIndex,
RebufferEndEvent.TYPE);
if (rebufferEndEventIndex == -1) {
fail("We have rebuffer start event at position: " + rebufferStartEventIndex
+ ",without matching rebuffer end event, events: "
+ networkRequest.getReceivedEventNames());
}
}
} catch (Exception e) {
fail(getExceptionFullTraceAndMessage(e));
}
}

@Test
public void testEndEvents() {
Expand Down

0 comments on commit 56a11c7

Please sign in to comment.