lmw
2023-06-13 4b7d8d9a038f6522df46d0f14fa07eb940a1b34d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.kuanzhai.driver.utils.view
 
import android.content.Context
import android.media.AudioManager
import android.util.AttributeSet
import cn.jzvd.JzvdStd
 
 
class CustomJzvd(context: Context?, attrs: AttributeSet?) : JzvdStd(context, attrs) {
 
    var completionView:CompletionView? = null
 
 
    override fun onCompletion() {
        super.onCompletion()
        if (completionView != null){
            completionView!!.completion()
        }
    }
 
    override fun onPrepared() {
        super.onPrepared()
        if (screen == SCREEN_FULLSCREEN) {
            mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 1, 0)
        } else {
            mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0)
        }
    }
 
    interface CompletionView{
        fun completion()
    }
 
 
}