Skip to content

Commit

Permalink
Merge pull request #24 from AAkira/dev/0.0.10
Browse files Browse the repository at this point in the history
Release 0.10.0
  • Loading branch information
AAkira authored Mar 23, 2018
2 parents 034f7e4 + bbe2913 commit 1ea9e87
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ buildscript {
}
dependencies {
implementation 'com.github.aakira:exoplayer-manager:0.0.9@aar'
implementation 'com.github.aakira:exoplayer-manager-ima:0.0.9@aar' // if you use an IMA SDK
implementation 'com.github.aakira:exoplayer-manager:0.10.0@aar'
implementation 'com.github.aakira:exoplayer-manager-ima:0.10.0@aar' // if you use an IMA SDK
}
```
## Using libraries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PlayerActivity : Activity() {
companion object {
// Apple Hls video [https://developer.apple.com/streaming/examples/]
const val HLS_SAMPLE_URL =
"https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8"
"https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8"
}

private val playerView: PlayerView by bindView(R.id.player_view)
Expand Down Expand Up @@ -58,7 +58,8 @@ class PlayerActivity : Activity() {
playerManager.setMaxVideoBitrate((60 * 1000).toLong())
}
playBackSpeedButton.setOnClickListener {
val currentSpeed = playerManager.getPlayBackParameters()?.speed ?: return@setOnClickListener
val currentSpeed = playerManager.getPlayBackParameters()?.speed
?: return@setOnClickListener
(if (currentSpeed > 2f) 0.4f else currentSpeed + 0.2f).let {
playerManager.setPlaybackParameters(it, 1f)
}
Expand All @@ -69,11 +70,10 @@ class PlayerActivity : Activity() {
playerManager.addOnVideoSizeChangedListener { width, height, unappliedRotationDegrees, pixelWidthHeightRatio ->

}
playerManager.addOnMediaSourceLoadErrorListener {
dataSpec: DataSpec?, dataType: Int, trackType: Int,
trackFormat: Format?, trackSelectionReason: Int, trackSelectionData: Any?,
mediaStartTimeMs: Long, mediaEndTimeMs: Long, elapsedRealtimeMs: Long,
loadDurationMs: Long, bytesLoaded: Long, error: IOException?, wasCanceled: Boolean ->
playerManager.addOnMediaSourceLoadErrorListener { dataSpec: DataSpec?, dataType: Int, trackType: Int,
trackFormat: Format?, trackSelectionReason: Int, trackSelectionData: Any?,
mediaStartTimeMs: Long, mediaEndTimeMs: Long, elapsedRealtimeMs: Long,
loadDurationMs: Long, bytesLoaded: Long, error: IOException?, wasCanceled: Boolean ->

}
playerManager.addOnStateChangedListener { playWhenReady: Boolean, playbackState: Int ->
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
buildscript {

// This library version
ext.LIBRARY_VERSION_CODE = 9
ext.LIBRARY_VERSION_NAME = "0.0.9"
ext.LIBRARY_VERSION_CODE = 10
ext.LIBRARY_VERSION_NAME = "0.10.0"

// App information
ext.COMPILE_SDK_VERSION = 27
Expand All @@ -16,7 +16,7 @@ buildscript {

// Base libraries
ext.KOTLIN_VERSION = "1.2.30"
ext.EXO_PLAYER_VERSION = "2.7.0"
ext.EXO_PLAYER_VERSION = "2.7.1"
ext.IMA_VERSION = "3.7.2"

// Others
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ class ExoPlayerManager(private val context: Context, private val debugLogger: Bo

var player: SimpleExoPlayer? = null
private set
/**
* Reset player position when player resets
*/
var prepareResetPosition: Boolean = false
/**
* Reset player state when player resets
*/
var prepareResetState: Boolean = false

private val bandwidthMeter = LimitBandwidthMeter()
private var eventProxy = EventProxy()
Expand Down Expand Up @@ -182,7 +190,7 @@ class ExoPlayerManager(private val context: Context, private val debugLogger: Bo
mediaSource ?: return

if (playerNeedsPrepare) {
player?.prepare(mediaSource)
player?.prepare(mediaSource, prepareResetPosition, prepareResetState)
playerNeedsPrepare = false
}

Expand Down

0 comments on commit 1ea9e87

Please sign in to comment.