Skip to content

Commit fbdb1cc

Browse files
Merge pull request #528 from romaingyh/pigeon_upgrade
Pigeon upgrade
2 parents 757bcdf + 85ec5bb commit fbdb1cc

File tree

23 files changed

+4972
-5784
lines changed

23 files changed

+4972
-5784
lines changed

flutter_vlc_player/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ android {
6262

6363
testLogging {
6464
events "passed", "skipped", "failed", "standardOut", "standardError"
65-
outputs.upToDateWhen {false}
65+
outputs.upToDateWhen { false }
6666
showStandardStreams = true
6767
}
6868
}
Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11
package software.solid.fluttervlcplayer.Enums;
22

33
public enum DataSourceType {
4-
5-
ASSET(0),
6-
NETWORK(1),
7-
FILE(2);
8-
9-
private int mType;
10-
11-
DataSourceType (int type)
12-
{
13-
this.mType = type;
14-
}
15-
16-
public int getNumericType() {
17-
return mType;
18-
}
19-
4+
ASSET,
5+
NETWORK,
6+
FILE
207
}
Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
package software.solid.fluttervlcplayer.Enums;
22

33
public enum HwAcc {
4-
5-
AUTOMATIC(-1),
6-
DISABLED(0),
7-
DECODING(1),
8-
FULL(2);
9-
10-
private int mType;
11-
12-
HwAcc (int type)
13-
{
14-
this.mType = type;
15-
}
16-
17-
public int getNumericType() {
18-
return mType;
19-
}
4+
AUTOMATIC,
5+
DISABLED,
6+
DECODING,
7+
FULL
208
}

flutter_vlc_player/android/src/main/java/software/solid/fluttervlcplayer/FlutterVlcPlayer.java

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
11
package software.solid.fluttervlcplayer;
22

3-
import org.videolan.libvlc.LibVLC;
4-
import org.videolan.libvlc.Media;
5-
import org.videolan.libvlc.MediaPlayer;
6-
import org.videolan.libvlc.RendererDiscoverer;
7-
import org.videolan.libvlc.RendererItem;
8-
import org.videolan.libvlc.interfaces.IMedia;
9-
import org.videolan.libvlc.interfaces.IVLCVout;
10-
113
import android.content.Context;
124
import android.graphics.Bitmap;
13-
import android.graphics.SurfaceTexture;
145
import android.net.Uri;
156
import android.util.Base64;
167
import android.util.Log;
17-
import android.view.Surface;
18-
import android.view.SurfaceView;
198
import android.view.View;
209

21-
import io.flutter.plugin.common.BinaryMessenger;
22-
import io.flutter.plugin.common.EventChannel;
23-
import io.flutter.plugin.platform.PlatformView;
24-
import io.flutter.view.TextureRegistry;
25-
import software.solid.fluttervlcplayer.Enums.HwAcc;
10+
import androidx.annotation.Nullable;
11+
12+
import org.videolan.libvlc.LibVLC;
13+
import org.videolan.libvlc.Media;
14+
import org.videolan.libvlc.MediaPlayer;
15+
import org.videolan.libvlc.RendererDiscoverer;
16+
import org.videolan.libvlc.RendererItem;
2617

2718
import java.io.ByteArrayOutputStream;
28-
import java.io.File;
2919
import java.io.IOException;
3020
import java.util.ArrayList;
3121
import java.util.HashMap;
3222
import java.util.List;
3323

24+
import io.flutter.plugin.common.BinaryMessenger;
25+
import io.flutter.plugin.common.EventChannel;
26+
import io.flutter.plugin.platform.PlatformView;
27+
import io.flutter.view.TextureRegistry;
28+
import software.solid.fluttervlcplayer.Enums.HwAcc;
29+
3430
final class FlutterVlcPlayer implements PlatformView {
3531

3632
private final String TAG = this.getClass().getSimpleName();
@@ -281,7 +277,7 @@ void setStreamUrl(String url, boolean isAssetUrl, boolean autoPlay, long hwAcc)
281277
Media media;
282278
if (isAssetUrl)
283279
media = new Media(libVLC, context.getAssets().openFd(url));
284-
else if(url.startsWith("content://"))
280+
else if (url.startsWith("content://"))
285281
media = new Media(libVLC, context.getContentResolver().openFileDescriptor(Uri.parse(url), "r").getFileDescriptor());
286282
else
287283
media = new Media(libVLC, Uri.parse(url));
@@ -346,7 +342,7 @@ float getPlaybackSpeed() {
346342
return mediaPlayer.getRate();
347343
}
348344

349-
void seekTo(int location) {
345+
void seekTo(long location) {
350346
if (mediaPlayer == null) return;
351347

352348
mediaPlayer.setTime(location);
@@ -633,10 +629,13 @@ void castToRenderer(String rendererDevice) {
633629
mediaPlayer.play();
634630
}
635631

632+
@Nullable
636633
String getSnapshot() {
637-
if (textureView == null) return "";
634+
if (textureView == null) return null;
638635

639636
Bitmap bitmap = textureView.getBitmap();
637+
if (bitmap == null) return null;
638+
640639
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
641640
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
642641
return Base64.encodeToString(outputStream.toByteArray(), Base64.NO_WRAP);

0 commit comments

Comments
 (0)