File tree Expand file tree Collapse file tree
app/src/main/java/com/openwebgal/demo Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -213,6 +213,9 @@ class MainActivity : AppCompatActivity() {
213213 AudioManager .STREAM_MUSIC ,
214214 AudioManager .AUDIOFOCUS_GAIN_TRANSIENT
215215 )
216+ // val pauseMediaScript =
217+ // "document.querySelectorAll('video, audio').forEach(mediaElement => mediaElement.pause())"
218+ // webView.evaluateJavascript(pauseMediaScript, null)
216219 webView.run {
217220 pauseTimers()
218221 onPause()
@@ -223,6 +226,15 @@ class MainActivity : AppCompatActivity() {
223226 // 游戏从后台恢复
224227 override fun onResume () {
225228 audioManager?.abandonAudioFocus(null )
229+ // val resumeMediaScript =
230+ // "document.querySelectorAll('video, audio').forEach(mediaElement => {" +
231+ // "if((!mediaElement.loop && !mediaElement.ended) || mediaElement.loop) {" +
232+ // "if(mediaElement.readyState >= 2) {" +
233+ // "mediaElement.play()" +
234+ // "}" +
235+ // "}" +
236+ // "})"
237+ // webView.evaluateJavascript(resumeMediaScript, null)
226238 webView.run {
227239 resumeTimers()
228240 onResume()
Original file line number Diff line number Diff line change 11// Top-level build file where you can add configuration options common to all sub-projects/modules.
22plugins {
3- id ' com.android.application' version ' 8.1.2 ' apply false
4- id ' com.android.library' version ' 8.1.2 ' apply false
3+ id ' com.android.application' version ' 8.2.0 ' apply false
4+ id ' com.android.library' version ' 8.2.0 ' apply false
55 id ' org.jetbrains.kotlin.android' version ' 1.8.0' apply false
66}
Original file line number Diff line number Diff line change 11# Fri Feb 03 09:54:54 CST 2023
22distributionBase =GRADLE_USER_HOME
3- distributionUrl =https\://services.gradle.org/distributions/gradle-8.0 -bin.zip
3+ distributionUrl =https\://services.gradle.org/distributions/gradle-8.2 -bin.zip
44distributionPath =wrapper/dists
55zipStorePath =wrapper/dists
66zipStoreBase =GRADLE_USER_HOME
You can’t perform that action at this time.
0 commit comments