7
7
import android .view .SurfaceHolder ;
8
8
import android .view .SurfaceView ;
9
9
import android .view .TextureView ;
10
+ import java .util .ArrayList ;
10
11
import org .videolan .libvlc .IVLCVout ;
11
12
import org .videolan .libvlc .LibVLC ;
12
13
import org .videolan .libvlc .Media ;
@@ -28,30 +29,35 @@ public class VlcVideoLibrary implements MediaPlayer.EventListener {
28
29
private SurfaceTexture surfaceTexture ;
29
30
private Surface surface ;
30
31
private SurfaceHolder surfaceHolder ;
32
+ private ArrayList <String > options = new ArrayList <>();
31
33
32
34
public VlcVideoLibrary (Context context , VlcListener vlcListener , SurfaceView surfaceView ) {
33
35
this .vlcListener = vlcListener ;
34
36
this .surfaceView = surfaceView ;
35
37
vlcInstance = new LibVLC (context , new VlcOptions ().getDefaultOptions ());
38
+ options .add (":fullscreen" );
36
39
}
37
40
38
41
public VlcVideoLibrary (Context context , VlcListener vlcListener , TextureView textureView ) {
39
42
this .vlcListener = vlcListener ;
40
43
this .textureView = textureView ;
41
44
vlcInstance = new LibVLC (context , new VlcOptions ().getDefaultOptions ());
45
+ options .add (":fullscreen" );
42
46
}
43
47
44
48
public VlcVideoLibrary (Context context , VlcListener vlcListener , SurfaceTexture surfaceTexture ) {
45
49
this .vlcListener = vlcListener ;
46
50
this .surfaceTexture = surfaceTexture ;
47
51
vlcInstance = new LibVLC (context , new VlcOptions ().getDefaultOptions ());
52
+ options .add (":fullscreen" );
48
53
}
49
54
50
55
public VlcVideoLibrary (Context context , VlcListener vlcListener , Surface surface ) {
51
56
this .vlcListener = vlcListener ;
52
57
this .surface = surface ;
53
58
surfaceHolder = null ;
54
59
vlcInstance = new LibVLC (context , new VlcOptions ().getDefaultOptions ());
60
+ options .add (":fullscreen" );
55
61
}
56
62
57
63
public VlcVideoLibrary (Context context , VlcListener vlcListener , Surface surface ,
@@ -60,6 +66,7 @@ public VlcVideoLibrary(Context context, VlcListener vlcListener, Surface surface
60
66
this .surface = surface ;
61
67
this .surfaceHolder = surfaceHolder ;
62
68
vlcInstance = new LibVLC (context , new VlcOptions ().getDefaultOptions ());
69
+ options .add (":fullscreen" );
63
70
}
64
71
65
72
public VlcVideoLibrary (Context context , VlcListener vlcListener , Surface surface , int width ,
@@ -70,6 +77,7 @@ public VlcVideoLibrary(Context context, VlcListener vlcListener, Surface surface
70
77
this .height = height ;
71
78
surfaceHolder = null ;
72
79
vlcInstance = new LibVLC (context , new VlcOptions ().getDefaultOptions ());
80
+ options .add (":fullscreen" );
73
81
}
74
82
75
83
public VlcVideoLibrary (Context context , VlcListener vlcListener , Surface surface ,
@@ -80,6 +88,11 @@ public VlcVideoLibrary(Context context, VlcListener vlcListener, Surface surface
80
88
this .width = width ;
81
89
this .height = height ;
82
90
vlcInstance = new LibVLC (context , new VlcOptions ().getDefaultOptions ());
91
+ options .add (":fullscreen" );
92
+ }
93
+
94
+ public void setOptions (ArrayList <String > options ) {
95
+ this .options = options ;
83
96
}
84
97
85
98
public boolean isPlaying () {
@@ -111,7 +124,11 @@ private void setMedia(Media media) {
111
124
//delay = network buffer + file buffer
112
125
//media.addOption(":network-caching=" + Constants.BUFFER);
113
126
//media.addOption(":file-caching=" + Constants.BUFFER);
114
- media .addOption (":fullscreen" );
127
+ if (options != null ) {
128
+ for (String s : options ) {
129
+ media .addOption (s );
130
+ }
131
+ }
115
132
media .setHWDecoderEnabled (true , false );
116
133
player = new MediaPlayer (vlcInstance );
117
134
player .setMedia (media );
0 commit comments