Skip to content

Commit

Permalink
Merge pull request #4 from StreamAMG/release/1.1.2
Browse files Browse the repository at this point in the history
SMD-689 SMD-691 Chromecast and bitrate fix
  • Loading branch information
StefanoStream authored May 19, 2022
2 parents 71537e8 + e37c3c0 commit 711ea17
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
4 changes: 4 additions & 0 deletions PlayKitReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,10 @@ PlayKit will atttempt to change bitrate to that value (or the closest one BELOW

All notable changes to this project will be documented in this section.

### 1.1.2
- Fixed chromecasting crash when offline
- Fixed bitrate selector crash when empty list

### 1.1.1
- Added startPosition to loadMedia
- Fixed bitrate selector icon when live
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ Change Log:

All notable changes to this project will be documented in this section.

### 1.1.2 - Fixed bitrate and offline issues

### 1.1.1 - PlayKit minor update

### 1.1.0 - Improved bitrate selector UI and Playkit updates
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ plugins {
id 'maven-publish'
}
// Versions of the library modules are matched (eg 1.0 core goes with 1.0 cloudmatrix) to prevent dependency issues
ext.SDK_VERSION_CODE = 12
ext.SDK_VERSION_NAME = "1.1.1"
ext.SDK_VERSION_CODE = 13
ext.SDK_VERSION_NAME = "1.1.2"

publishing {
publications {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.hardware.SensorManager
import android.os.Handler
import android.os.Looper
import android.util.AttributeSet
import android.util.Log
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.OrientationEventListener
Expand Down Expand Up @@ -39,10 +40,10 @@ import com.streamamg.amg_playkit.playkitExtensions.FlavorAsset
import com.streamamg.amg_playkit.playkitExtensions.isLive
import com.streamamg.amg_playkit.playkitExtensions.setBitrate
import com.streamamg.amg_playkit.playkitExtensions.updateBitrateSelector
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.*
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import java.io.IOException
import java.net.URL
import java.util.*
import kotlin.collections.ArrayList
Expand Down Expand Up @@ -346,9 +347,16 @@ class AMGPlayKit : LinearLayout, AMGPlayerInterface {
.get()
.build()
thread {
val response = client.newCall(request).execute()
val responseBody = response.request.url.toString()
sendCastingURL(responseBody)
client.newCall(request).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
Log.e(this@AMGPlayKit.javaClass.simpleName, e.localizedMessage)
}

override fun onResponse(call: Call, response: Response) {
val responseBody = response.request.url.toString()
sendCastingURL(responseBody)
}
})
}
}

Expand Down Expand Up @@ -490,7 +498,9 @@ class AMGPlayKit : LinearLayout, AMGPlayerInterface {

updateAnalyticsPlugin(mediaConfig.entryID)
player?.prepare(mediaConfig.mediaConfig)
updateBitrateSelector()
if (bitrateSelector) {
updateBitrateSelector()
}

controlsView.setMediaType(mediaType)
if (mediaType == AMGMediaType.VOD){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,10 @@ class AMGPlayKitStandardControl : LinearLayout, AMGControlInterface {

fun createBitrateSelector(bitrates: List<FlavorAsset>? = null) {
bitrateSelectorView.removeAllViews()
bitrateSelectorView.addView(bitrateButton(bitrates?.last(), 0, "Auto"))
if (bitrates != null) {
bitrates.forEachIndexed { index, bitrate ->
bitrateSelectorView.addView(bitrateDivider())
bitrateSelectorView.addView(bitrateButton(bitrate, index+1, "${bitrate.bitrate}"))
}
bitrateSelectorView.addView(bitrateButton(bitrates?.lastOrNull(), 0, "Auto"))
bitrates?.forEachIndexed { index, bitrate ->
bitrateSelectorView.addView(bitrateDivider())
bitrateSelectorView.addView(bitrateButton(bitrate, index+1, "${bitrate.bitrate}"))
}
}

Expand Down

0 comments on commit 711ea17

Please sign in to comment.