|
@@ -0,0 +1,49 @@
|
|
1
|
+package com.shuangyubang.mofun_flutter_plugin_video
|
|
2
|
+
|
|
3
|
+import android.content.Context
|
|
4
|
+import android.view.Gravity
|
|
5
|
+import android.view.View
|
|
6
|
+import android.widget.EditText
|
|
7
|
+import android.widget.FrameLayout
|
|
8
|
+import android.widget.LinearLayout
|
|
9
|
+import com.fgodt.mixplayer.Player
|
|
10
|
+import com.fgodt.mixplayer.mixPlayerCallBack
|
|
11
|
+
|
|
12
|
+class MofunRealVideoView(val context: Context) : mixPlayerCallBack {
|
|
13
|
+
|
|
14
|
+ private var trueView:FrameLayout? = null
|
|
15
|
+
|
|
16
|
+ fun getView(): View? {
|
|
17
|
+ synchronized(MofunRealVideoView::class) {
|
|
18
|
+ if (trueView == null){
|
|
19
|
+ initView()
|
|
20
|
+ }
|
|
21
|
+ }
|
|
22
|
+ return trueView
|
|
23
|
+ }
|
|
24
|
+
|
|
25
|
+ private fun initView(){
|
|
26
|
+ trueView = FrameLayout(context)
|
|
27
|
+ val params = FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
|
|
28
|
+ FrameLayout.LayoutParams.WRAP_CONTENT)
|
|
29
|
+ params.gravity = Gravity.TOP
|
|
30
|
+ params.height = 1080 * 9 / 16
|
|
31
|
+ val mixplayer = Player(context)
|
|
32
|
+ mixplayer.setMixCall(this)
|
|
33
|
+ mixplayer.addMixSource("mix1", 0.0, -1.0)
|
|
34
|
+ mixplayer.addMixSource("silence", 0.0, -1.0)
|
|
35
|
+ // mixplayer.selectAudioSource("silence");
|
|
36
|
+ // mixplayer.selectAudioSource("mix1");
|
|
37
|
+
|
|
38
|
+ trueView?.addView(mixplayer, params)
|
|
39
|
+
|
|
40
|
+ }
|
|
41
|
+
|
|
42
|
+ override fun mix_call(name: String?, data: ByteArray?, len: Int): Int {
|
|
43
|
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
|
44
|
+ }
|
|
45
|
+
|
|
46
|
+ override fun closeMsg(msg: String?) {
|
|
47
|
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
|
48
|
+ }
|
|
49
|
+}
|