Skip to content

Commit 3c538da

Browse files
author
kongdywang
committed
update to 12.8.1 & Enhance rendering compatibility & player widget's delegate not required now
1 parent 363adfa commit 3c538da

File tree

16 files changed

+90
-109
lines changed

16 files changed

+90
-109
lines changed

Flutter/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11

2+
#### Version: 12.8.1 2025.10.23
3+
4+
##### Features:
5+
6+
- Enhance rendering compatibility.
7+
8+
29
#### Version: 12.8.0 2025.09.19
310

411
##### Features:

Flutter/CI/buildVersionOnMac.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildLog() {
55
}
66

77
inputVersion=$1
8-
export VERSION_NAME="12.8.0"
8+
export VERSION_NAME="12.8.1"
99
if [ -n "$inputVersion" ]; then
1010
VERSION_NAME=$inputVersion
1111
fi

Flutter/android/config.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ rootProject.ext {
44
supportSdkVersion = "26.0.1"
55
minSdkVersion = 19
66
targetSdkVersion = 28
7-
playerVersion = "12.8.0"
7+
playerVersion = "12.8.1"
88
compat = "androidx.appcompat:appcompat:1.6.1"
99

1010
/**

Flutter/android/src/main/java/com/tencent/vod/flutter/player/render/gl/FTXEGLRender.java

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import android.opengl.EGLContext;
77
import android.opengl.EGLDisplay;
88
import android.opengl.EGLSurface;
9-
import android.opengl.GLES30;
109
import android.os.Handler;
1110
import android.os.HandlerThread;
1211
import android.view.Surface;
@@ -29,11 +28,12 @@ public class FTXEGLRender implements SurfaceTexture.OnFrameAvailableListener {
2928
private SurfaceTexture mSurfaceTexture;
3029
private FTXTextureRender mTextureRender;
3130
private Surface mInputSurface;
31+
private Surface mOutPutSurface;
3232

3333
private EGLDisplay mEGLDisplay = EGL14.EGL_NO_DISPLAY;
34-
private EGLContext mEGLContext = EGL14.EGL_NO_CONTEXT;
34+
private final EGLContext mEGLContext = EGL14.EGL_NO_CONTEXT;
3535
private EGLContext mEGLContextEncoder = EGL14.EGL_NO_CONTEXT;
36-
private EGLSurface mEGLSurface = EGL14.EGL_NO_SURFACE;
36+
private final EGLSurface mEGLSurface = EGL14.EGL_NO_SURFACE;
3737
private EGLSurface mEGLSurfaceEncoder = EGL14.EGL_NO_SURFACE;
3838

3939
private EGLContext mEGLSavedContext = EGL14.EGL_NO_CONTEXT;
@@ -98,12 +98,14 @@ public void run() {
9898
private synchronized void startDrawSurface() {
9999
try {
100100
if (!mStart) {
101-
LiteavLog.e(TAG, "end....... ");
101+
LiteavLog.e(TAG, "draw thread is dead");
102102
return;
103103
}
104104
saveCurrentEglEnvironment();
105105
if (!makeCurrent(1)) {
106-
LiteavLog.e(TAG, "makeCurrent error");
106+
return;
107+
}
108+
if (!mOutPutSurface.isValid()) {
107109
return;
108110
}
109111

@@ -137,7 +139,6 @@ public boolean initOpengl(Surface surface, boolean needClearOld) {
137139
}
138140

139141
if (!makeCurrent(1)) {
140-
LiteavLog.e(TAG, "makeCurrent error");
141142
bRet = false;
142143
break;
143144
}
@@ -211,44 +212,37 @@ public void setViewPortSize(int width, int height) {
211212
private boolean eglSetup(Surface surface) {
212213
mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
213214
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
214-
LiteavLog.e(TAG, "unable to get EGL10 display");
215+
checkEglError("unable to get EGL10 display");
215216
return false;
216217
}
217218

218219
int[] version = new int[2];
219220
if (!EGL14.eglInitialize(mEGLDisplay, version, 0, version, 1)) {
220-
LiteavLog.e(TAG, "unable to initialize EGL10");
221+
checkEglError("unable to initialize EGL10");
221222
return false;
222223
}
223-
int[] maxSamples = new int[1];
224-
GLES30.glGetIntegerv(GLES30.GL_MAX_SAMPLES, maxSamples, 0);
225-
//noinspection ExtractMethodRecommender
226-
final int samples = Math.min(4, maxSamples[0]);
227224
// Configure EGL for pbuffer and OpenGL ES 2.0, 24-bit RGB.
228225
int[] attribList = new int[]{
229226
EGL14.EGL_RED_SIZE, 8,
230227
EGL14.EGL_GREEN_SIZE, 8,
231228
EGL14.EGL_BLUE_SIZE, 8,
232229
EGL14.EGL_ALPHA_SIZE, 8,
233-
EGL14.EGL_DEPTH_SIZE, 8,
234230
EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
235231
EGL14.EGL_SURFACE_TYPE, EGL14.EGL_WINDOW_BIT,
236-
EGL14.EGL_SAMPLE_BUFFERS, 1,
237-
EGL14.EGL_SAMPLES, samples,
238232
EGL14.EGL_NONE
239233
};
240234

241235
int[] numEglConfigs = new int[1];
242236
EGLConfig[] eglConfigs = new EGLConfig[1];
243237
if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, eglConfigs, 0,
244238
eglConfigs.length, numEglConfigs, 0)) {
245-
LiteavLog.e(TAG, "eglChooseConfig error");
239+
checkEglError("eglChooseConfig error");
246240
return false;
247241
}
248242
// Configure context for OpenGL ES 2.0.
249243
//6、创建 EglContext
250244
int[] attrib_list = new int[]{
251-
EGL14.EGL_CONTEXT_CLIENT_VERSION, 3,
245+
EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
252246
EGL14.EGL_NONE
253247
};
254248

@@ -271,6 +265,7 @@ private boolean eglSetup(Surface surface) {
271265
LiteavLog.e(TAG, "surface was null");
272266
return false;
273267
}
268+
mOutPutSurface = surface;
274269
return true;
275270
}
276271

@@ -279,6 +274,8 @@ private boolean checkEglError(String msg) {
279274
if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
280275
LiteavLog.e(TAG, "checkEglError: " + msg + "error: " + error);
281276
return false;
277+
} else {
278+
LiteavLog.e(TAG, msg);
282279
}
283280

284281
return true;
@@ -287,16 +284,15 @@ private boolean checkEglError(String msg) {
287284
public boolean makeCurrent(int index) {
288285
if (index == 0) {
289286
if (!EGL14.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext)) {
290-
LiteavLog.e(TAG, "eglMakeCurrent failed");
287+
checkEglError("makeCurrent");
291288
return false;
292289
}
293290
} else {
294291
if (!EGL14.eglMakeCurrent(mEGLDisplay, mEGLSurfaceEncoder, mEGLSurfaceEncoder, mEGLContextEncoder)) {
295-
LiteavLog.e(TAG, "eglMakeCurrent failed");
292+
checkEglError("makeCurrent");
296293
return false;
297294
}
298295
}
299-
300296
return true;
301297
}
302298

@@ -313,11 +309,6 @@ private void saveCurrentEglEnvironment() {
313309
mEGLSavedContext = EGL14.eglGetCurrentContext();
314310
mEGLSaveDrawSurface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
315311
mEGLSaveReadSurface = EGL14.eglGetCurrentSurface(EGL14.EGL_READ);
316-
317-
// // 检查有效性
318-
// if (mEGLSavedDisplay == EGL14.EGL_NO_DISPLAY || mEGLSavedContext == EGL14.EGL_NO_CONTEXT) {
319-
// LiteavLog.w(TAG, "Saving invalid EGL state");
320-
// }
321312
} catch (Exception e) {
322313
LiteavLog.e(TAG, "Save EGL error: " + e);
323314
resetSavedEnvironment();

Flutter/android/src/main/java/com/tencent/vod/flutter/player/render/gl/FTXTextureRender.java

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.tencent.vod.flutter.player.render.gl;
22

33
import android.opengl.GLES11Ext;
4-
import android.opengl.GLES30;
4+
import android.opengl.GLES20;
55
import android.opengl.Matrix;
66

77
import com.tencent.liteav.base.util.LiteavLog;
@@ -82,10 +82,10 @@ public FTXTextureRender(int width, int height) {
8282
*/
8383
public void surfaceCreated() {
8484
mVideoFragmentProgram = TXGlUtilVideo.createProgram(VERTEX_SHADER, VIDEO_FRAGMENT_SHADER);
85-
maPositionHandle = GLES30.glGetAttribLocation(mVideoFragmentProgram, "aPosition");
86-
maTexCoordHandle = GLES30.glGetAttribLocation(mVideoFragmentProgram, "aTextureCoord");
87-
muMVPMatrixHandle = GLES30.glGetUniformLocation(mVideoFragmentProgram, "uMVPMatrix");
88-
maTextureHandle = GLES30.glGetUniformLocation(mVideoFragmentProgram, "sTexture");
85+
maPositionHandle = GLES20.glGetAttribLocation(mVideoFragmentProgram, "aPosition");
86+
maTexCoordHandle = GLES20.glGetAttribLocation(mVideoFragmentProgram, "aTextureCoord");
87+
muMVPMatrixHandle = GLES20.glGetUniformLocation(mVideoFragmentProgram, "uMVPMatrix");
88+
maTextureHandle = GLES20.glGetUniformLocation(mVideoFragmentProgram, "sTexture");
8989

9090
textureID[0] = initTex();
9191
}
@@ -95,8 +95,8 @@ public int getTextureID() {
9595
}
9696

9797
public void deleteTexture() {
98-
GLES30.glDeleteProgram(mVideoFragmentProgram);
99-
GLES30.glDeleteTextures(1, textureID, 0);
98+
GLES20.glDeleteProgram(mVideoFragmentProgram);
99+
GLES20.glDeleteTextures(1, textureID, 0);
100100
}
101101

102102
/**
@@ -106,17 +106,17 @@ public void deleteTexture() {
106106
*/
107107
public int initTex() {
108108
int[] tex = new int[1];
109-
GLES30.glGenTextures(1, tex, 0);
110-
GLES30.glActiveTexture(GLES30.GL_TEXTURE0);
111-
GLES30.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex[0]);
112-
GLES30.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
113-
GLES30.GL_TEXTURE_WRAP_S, GLES30.GL_CLAMP_TO_EDGE);
114-
GLES30.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
115-
GLES30.GL_TEXTURE_WRAP_T, GLES30.GL_CLAMP_TO_EDGE);
116-
GLES30.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
117-
GLES30.GL_TEXTURE_MIN_FILTER, GLES30.GL_LINEAR);
118-
GLES30.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
119-
GLES30.GL_TEXTURE_MAG_FILTER, GLES30.GL_LINEAR);
109+
GLES20.glGenTextures(1, tex, 0);
110+
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
111+
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex[0]);
112+
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
113+
GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
114+
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
115+
GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
116+
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
117+
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
118+
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
119+
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
120120
return tex[0];
121121
}
122122

@@ -201,8 +201,8 @@ private void mergerMatrix() {
201201
}
202202

203203
public void cleanDrawCache() {
204-
GLES30.glViewport(0, 0, mPortWidth, mPortHeight);
205-
GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT);
204+
GLES20.glViewport(0, 0, mPortWidth, mPortHeight);
205+
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
206206
}
207207

208208
/**
@@ -211,30 +211,30 @@ public void cleanDrawCache() {
211211
public void drawFrame() {
212212
cleanDrawCache();
213213
// video frame
214-
GLES30.glUseProgram(mVideoFragmentProgram);
214+
GLES20.glUseProgram(mVideoFragmentProgram);
215215

216216
// OpenGL rotates counterclockwise, here it needs to be modified to rotate clockwise
217-
GLES30.glUniformMatrix4fv(muMVPMatrixHandle, 1, false, mResultMatrix, 0);
217+
GLES20.glUniformMatrix4fv(muMVPMatrixHandle, 1, false, mResultMatrix, 0);
218218

219-
GLES30.glActiveTexture(GLES30.GL_TEXTURE0);
220-
GLES30.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureID[0]);
221-
GLES30.glUniform1i(maTextureHandle, 0);
219+
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
220+
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureID[0]);
221+
GLES20.glUniform1i(maTextureHandle, 0);
222222

223223
// Enable the "aPosition" vertex attribute.
224-
GLES30.glEnableVertexAttribArray(maPositionHandle);
224+
GLES20.glEnableVertexAttribArray(maPositionHandle);
225225
// Connect vertexBuffer to "aPosition".
226-
GLES30.glVertexAttribPointer(maPositionHandle, 3,
227-
GLES30.GL_FLOAT, false, 3 * FLOAT_SIZE_BYTES, FULL_RECTANGLE_BUF);
226+
GLES20.glVertexAttribPointer(maPositionHandle, 3,
227+
GLES20.GL_FLOAT, false, 3 * FLOAT_SIZE_BYTES, FULL_RECTANGLE_BUF);
228228
// Enable the "aTextureCoord" vertex attribute.
229-
GLES30.glEnableVertexAttribArray(maTexCoordHandle);
229+
GLES20.glEnableVertexAttribArray(maTexCoordHandle);
230230
// Connect texBuffer to "aTextureCoord".
231-
GLES30.glVertexAttribPointer(maTexCoordHandle, 4,
232-
GLES30.GL_FLOAT, false, 4 * FLOAT_SIZE_BYTES, FULL_RECTANGLE_TEX_BUF);
231+
GLES20.glVertexAttribPointer(maTexCoordHandle, 4,
232+
GLES20.GL_FLOAT, false, 4 * FLOAT_SIZE_BYTES, FULL_RECTANGLE_TEX_BUF);
233233
// Draw the rect.
234-
GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, 4);
234+
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
235235
// Done -- disable vertex array, texture, and program.
236-
GLES30.glDisableVertexAttribArray(maPositionHandle);
237-
GLES30.glDisableVertexAttribArray(maTexCoordHandle);
238-
GLES30.glUseProgram(0);
236+
GLES20.glDisableVertexAttribArray(maPositionHandle);
237+
GLES20.glDisableVertexAttribArray(maTexCoordHandle);
238+
GLES20.glUseProgram(0);
239239
}
240240
}

Flutter/example/lib/demo_short_video_player.dart

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,11 @@ class _DemoShortVideoPlayerState extends State<DemoShortVideoPlayer> with Widget
3030
void _loadData() async {
3131
// check license
3232
final ShortVideoDataLoader loader = ShortVideoDataLoader();
33-
if (!isLicenseSuc.isCompleted) {
34-
SuperPlayerPlugin.setGlobalLicense(LICENSE_URL, LICENSE_KEY);
35-
await isLicenseSuc.future;
36-
loader.getPageListDataOneByOneFunction((dataModels) {
37-
setState(() {
38-
superPlayerModelList = dataModels;
39-
});
33+
loader.getPageListDataOneByOneFunction((dataModels) {
34+
setState(() {
35+
superPlayerModelList = dataModels;
4036
});
41-
} else {
42-
loader.getPageListDataOneByOneFunction((dataModels) {
43-
setState(() {
44-
superPlayerModelList = dataModels;
45-
});
46-
});
47-
}
37+
});
4838
}
4939

5040
@override

Flutter/example/lib/demo_superplayer.dart

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,7 @@ class _DemoSuperPlayerState extends State<DemoSuperPlayer> with TXPipPlayerResto
299299
void playCurrentModel(SuperPlayerModel model, double startTime) async {
300300
currentVideoModel = model;
301301
await _controller.setStartTime(startTime);
302-
// check license
303-
if (!isLicenseSuc.isCompleted) {
304-
SuperPlayerPlugin.setGlobalLicense(LICENSE_URL, LICENSE_KEY);
305-
await isLicenseSuc.future;
306-
await _controller.playWithModelNeedLicence(model);
307-
} else {
308-
await _controller.playWithModelNeedLicence(model);
309-
}
302+
await _controller.playWithModelNeedLicence(model);
310303
}
311304

312305
void playVideo(SuperPlayerModel model) {

Flutter/example/lib/demo_txLiveplayer.dart

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,7 @@ class _DemoTXLivePlayerState extends State<DemoTXLivePlayer> with WidgetsBinding
6565
});
6666

6767
_controller.setRenderMode(FTXPlayerRenderMode.ADJUST_RESOLUTION);
68-
69-
if (!isLicenseSuc.isCompleted) {
70-
SuperPlayerPlugin.setGlobalLicense(LICENSE_URL, LICENSE_KEY);
71-
await isLicenseSuc.future;
72-
await _controller.startLivePlay(_url);
73-
} else {
74-
await _controller.startLivePlay(_url);
75-
}
68+
await _controller.startLivePlay(_url);
7669
}
7770

7871
@override

Flutter/example/lib/demo_txvodplayer.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,7 @@ class _DemoTXVodPlayerState extends State<DemoTXVodPlayer> with WidgetsBindingOb
7676

7777
await _controller.setConfig(FTXVodPlayConfig());
7878
await _controller.setRenderMode(_renderMode);
79-
if (!isLicenseSuc.isCompleted) {
80-
SuperPlayerPlugin.setGlobalLicense(LICENSE_URL, LICENSE_KEY);
81-
await isLicenseSuc.future;
82-
await _controller.startVodPlay(_url);
83-
} else {
84-
await _controller.startVodPlay(_url);
85-
}
79+
await _controller.startVodPlay(_url);
8680
}
8781

8882
@override

Flutter/example/lib/main.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ class _MyAppState extends State<MyApp> {
113113
return MaterialApp(
114114
localizationsDelegates: [
115115
AppLocalizationDelegate.delegate,
116-
SuperPlayerWidgetLocals.delegate,
117116
GlobalWidgetsLocalizations.delegate,
118117
GlobalMaterialLocalizations.delegate,
119118
GlobalCupertinoLocalizations.delegate,

0 commit comments

Comments
 (0)