mirror of
https://github.com/sifacaii/VlcJellyfin
synced 2025-06-03 00:58:06 -04:00
集成libvlc-3.5.1
This commit is contained in:
parent
bf265a86ab
commit
65b723d064
@ -1,5 +1,4 @@
|
|||||||
Jellyfin androidtv client
|
Jellyfin androidtv client
|
||||||
|
jellyfin安卓TV客户端,支持安卓4.2以上。
|
||||||
android 4.2以上
|
在安卓4.4及以下环境中运行时,集成的VLC播放器可能无法播放HTTPS,可在右上角菜单勾选"调用外部播放器"选项,使用外部播放器播放。
|
||||||
|
支持jellyfin8.1以上
|
||||||
jellyfin8.1以上
|
|
||||||
|
@ -5,7 +5,6 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.lzy.okgo.OkGo;
|
import com.lzy.okgo.OkGo;
|
||||||
@ -18,10 +17,19 @@ import org.sifacai.vlcjellyfin.Bean.Items;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import javax.net.ssl.HostnameVerifier;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLSession;
|
||||||
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
|
||||||
public class JfClient {
|
public class JfClient {
|
||||||
@ -41,6 +49,70 @@ public class JfClient {
|
|||||||
stop
|
stop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* description 忽略https证书验证
|
||||||
|
*
|
||||||
|
* @author yanzy
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2021/9/8 14:42
|
||||||
|
*/
|
||||||
|
private static TrustManager[] getTrustManager() {
|
||||||
|
TrustManager[] trustAllCerts = new TrustManager[]{
|
||||||
|
new X509TrustManager() {
|
||||||
|
@Override
|
||||||
|
public void checkClientTrusted(X509Certificate[] chain, String authType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkServerTrusted(X509Certificate[] chain, String authType) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return new X509Certificate[]{};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return trustAllCerts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* description 忽略https证书验证
|
||||||
|
*`在这里插入代码片`
|
||||||
|
* @author yanzy
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2021/9/8 14:42
|
||||||
|
*/
|
||||||
|
public static SSLSocketFactory getSSLSocketFactory() {
|
||||||
|
try {
|
||||||
|
SSLContext sslContext = SSLContext.getInstance("SSL");
|
||||||
|
sslContext.init(null, getTrustManager(), new SecureRandom());
|
||||||
|
return sslContext.getSocketFactory();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* description 忽略https证书验证
|
||||||
|
*
|
||||||
|
* @author yanzy
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2021/9/8 14:42
|
||||||
|
*/
|
||||||
|
public static HostnameVerifier getHostnameVerifier() {
|
||||||
|
HostnameVerifier hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String s, SSLSession sslSession) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return hostnameVerifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化配置
|
* 初始化配置
|
||||||
*
|
*
|
||||||
@ -50,6 +122,8 @@ public class JfClient {
|
|||||||
config = new Config(application);
|
config = new Config(application);
|
||||||
SetHeaders();
|
SetHeaders();
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
|
builder.sslSocketFactory(getSSLSocketFactory());
|
||||||
|
builder.hostnameVerifier(getHostnameVerifier());
|
||||||
builder.connectTimeout(5, TimeUnit.SECONDS);
|
builder.connectTimeout(5, TimeUnit.SECONDS);
|
||||||
builder.readTimeout(3, TimeUnit.SECONDS);
|
builder.readTimeout(3, TimeUnit.SECONDS);
|
||||||
builder.writeTimeout(5, TimeUnit.SECONDS);
|
builder.writeTimeout(5, TimeUnit.SECONDS);
|
||||||
|
@ -15,6 +15,7 @@ import android.widget.ProgressBar;
|
|||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.videolan.libvlc.Dialog;
|
||||||
import org.videolan.libvlc.LibVLC;
|
import org.videolan.libvlc.LibVLC;
|
||||||
import org.videolan.libvlc.Media;
|
import org.videolan.libvlc.Media;
|
||||||
import org.videolan.libvlc.MediaPlayer;
|
import org.videolan.libvlc.MediaPlayer;
|
||||||
@ -87,11 +88,49 @@ public class VlcPlayerActivity extends BaseActivity implements MediaPlayer.Event
|
|||||||
vlcoptions.add("-v");
|
vlcoptions.add("-v");
|
||||||
vlcVideoLayout = findViewById(R.id.VideoView);
|
vlcVideoLayout = findViewById(R.id.VideoView);
|
||||||
libVLC = new LibVLC(this,vlcoptions);
|
libVLC = new LibVLC(this,vlcoptions);
|
||||||
|
Dialog.setCallbacks(libVLC,callbacks);
|
||||||
|
|
||||||
mediaPlayer = new MediaPlayer(libVLC);
|
mediaPlayer = new MediaPlayer(libVLC);
|
||||||
mediaPlayer.attachViews(vlcVideoLayout, null, true, false);
|
mediaPlayer.attachViews(vlcVideoLayout, null, true, false);
|
||||||
mediaPlayer.setEventListener(this);
|
mediaPlayer.setEventListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dialog.Callbacks callbacks = new Dialog.Callbacks() {
|
||||||
|
@Override
|
||||||
|
public void onDisplay(Dialog.ErrorMessage dialog) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisplay(Dialog.LoginDialog dialog) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisplay(Dialog.QuestionDialog dialog) {
|
||||||
|
if(dialog.getQuestionType() == 1){
|
||||||
|
dialog.postAction(1);
|
||||||
|
}else {
|
||||||
|
Log.d(TAG, "onDisplay_QuestionDialog: " + dialog.getQuestionType() + " : " + dialog.getTitle() + " : " + dialog.getText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisplay(Dialog.ProgressDialog dialog) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCanceled(Dialog dialog) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProgressUpdate(Dialog.ProgressDialog dialog) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(MediaPlayer.Event event) {
|
public void onEvent(MediaPlayer.Event event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user