Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flutter_vlc_player/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ android {

testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen {false}
outputs.upToDateWhen { false }
showStandardStreams = true
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
package software.solid.fluttervlcplayer.Enums;

public enum DataSourceType {

ASSET(0),
NETWORK(1),
FILE(2);

private int mType;

DataSourceType (int type)
{
this.mType = type;
}

public int getNumericType() {
return mType;
}

ASSET,
NETWORK,
FILE
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
package software.solid.fluttervlcplayer.Enums;

public enum HwAcc {

AUTOMATIC(-1),
DISABLED(0),
DECODING(1),
FULL(2);

private int mType;

HwAcc (int type)
{
this.mType = type;
}

public int getNumericType() {
return mType;
}
AUTOMATIC,
DISABLED,
DECODING,
FULL
}
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
package software.solid.fluttervlcplayer;

import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.MediaPlayer;
import org.videolan.libvlc.RendererDiscoverer;
import org.videolan.libvlc.RendererItem;
import org.videolan.libvlc.interfaces.IMedia;
import org.videolan.libvlc.interfaces.IVLCVout;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.SurfaceTexture;
import android.net.Uri;
import android.util.Base64;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceView;
import android.view.View;

import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.EventChannel;
import io.flutter.plugin.platform.PlatformView;
import io.flutter.view.TextureRegistry;
import software.solid.fluttervlcplayer.Enums.HwAcc;
import androidx.annotation.Nullable;

import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.MediaPlayer;
import org.videolan.libvlc.RendererDiscoverer;
import org.videolan.libvlc.RendererItem;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.EventChannel;
import io.flutter.plugin.platform.PlatformView;
import io.flutter.view.TextureRegistry;
import software.solid.fluttervlcplayer.Enums.HwAcc;

final class FlutterVlcPlayer implements PlatformView {

private final String TAG = this.getClass().getSimpleName();
Expand Down Expand Up @@ -281,7 +277,7 @@ void setStreamUrl(String url, boolean isAssetUrl, boolean autoPlay, long hwAcc)
Media media;
if (isAssetUrl)
media = new Media(libVLC, context.getAssets().openFd(url));
else if(url.startsWith("content://"))
else if (url.startsWith("content://"))
media = new Media(libVLC, context.getContentResolver().openFileDescriptor(Uri.parse(url), "r").getFileDescriptor());
else
media = new Media(libVLC, Uri.parse(url));
Expand Down Expand Up @@ -346,7 +342,7 @@ float getPlaybackSpeed() {
return mediaPlayer.getRate();
}

void seekTo(int location) {
void seekTo(long location) {
if (mediaPlayer == null) return;

mediaPlayer.setTime(location);
Expand Down Expand Up @@ -633,10 +629,13 @@ void castToRenderer(String rendererDevice) {
mediaPlayer.play();
}

@Nullable
String getSnapshot() {
if (textureView == null) return "";
if (textureView == null) return null;

Bitmap bitmap = textureView.getBitmap();
if (bitmap == null) return null;

ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
return Base64.encodeToString(outputStream.toByteArray(), Base64.NO_WRAP);
Expand Down
Loading