Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanmedack committed Dec 27, 2017
2 parents b02be29 + d89abc6 commit 8138e77
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ android {
applicationId "de.stefanmedack.ccctv"
minSdkVersion 21
targetSdkVersion 26
versionCode 7
versionName "2.0.0-RC4"
versionCode 8
versionName "2.0.0-RC5"
resConfigs "en", "de"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.Intent
import android.os.Bundle
import android.support.v4.app.ActivityOptionsCompat
import android.view.KeyEvent
import android.view.WindowManager
import android.widget.ImageView
import de.stefanmedack.ccctv.R
import de.stefanmedack.ccctv.persistence.entities.Event
Expand All @@ -23,6 +24,9 @@ class DetailActivity : BaseInjectableActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.fragment_activity)

// prevent stand-by while playing videos
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

if (savedInstanceState == null) {
fragment = DetailFragment()
fragment?.arguments = Bundle(2).apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package de.stefanmedack.ccctv.ui.playback
import android.content.Intent
import android.os.Bundle
import android.support.v4.app.FragmentActivity
import android.view.WindowManager
import de.stefanmedack.ccctv.R
import de.stefanmedack.ccctv.util.STREAM_URL
import info.metadude.java.library.brockman.models.Stream
Expand All @@ -14,15 +15,16 @@ class ExoPlayerActivity : FragmentActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_video_example)

// prevent stand-by while playing videos
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

val ft = supportFragmentManager.beginTransaction()
ft.add(
R.id.videoFragment,
ExoPlayerFragment().apply {
arguments = Bundle(1).also {
it.putString(STREAM_URL, intent.getStringExtra(STREAM_URL))
}
},
ExoPlayerFragment.TAG)
val fragment = ExoPlayerFragment().apply {
arguments = Bundle(1).also {
it.putString(STREAM_URL, intent.getStringExtra(STREAM_URL))
}
}
ft.add(R.id.videoFragment, fragment, ExoPlayerFragment.TAG)
ft.commit()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ExoPlayerFragment : VideoSupportFragment() {
}

override fun onPause() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && activity.isInPictureInPictureMode) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N || !activity.isInPictureInPictureMode) {
mediaPlayerGlue.pause()
}
super.onPause()
Expand Down

0 comments on commit 8138e77

Please sign in to comment.