Commit 4a560b40 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Allow to pass a Surface object to Core native video window id methods

parent 1f79de8a
......@@ -354,12 +354,19 @@ public class AndroidPlatformHelper {
}
public synchronized void setVideoPreviewView(Object view) {
if (view instanceof Surface) {
Surface surface = (Surface) view;
setNativePreviewWindowId(mNativePtr, surface);
return;
}
if (!(view instanceof TextureView)) {
throw new RuntimeException("[Platform Helper] Preview window id is not an instance of TextureView. " +
"Please update your UI layer so that the preview video view is a TextureView (or an instance of it)" +
"or enable compatibility mode by setting displaytype=MSAndroidOpenGLDisplay in the [video] section your linphonerc factory configuration file" +
"so you can keep using your existing application code for managing video views.");
}
mPreviewTextureView = (TextureView)view;
ViewGroup.LayoutParams lp = mPreviewTextureView.getLayoutParams();
mPreviewTextureView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
......@@ -387,6 +394,7 @@ public class AndroidPlatformHelper {
}
});
if (mPreviewTextureView.isAvailable()) {
Log.i("[Platform Helper] Preview window surface is available");
setNativePreviewWindowId(mNativePtr, mPreviewTextureView.getSurfaceTexture());
......@@ -394,12 +402,19 @@ public class AndroidPlatformHelper {
}
public synchronized void setVideoRenderingView(Object view) {
if (view instanceof Surface) {
Surface surface = (Surface) view;
setNativeVideoWindowId(mNativePtr, surface);
return;
}
if (!(view instanceof TextureView)) {
throw new RuntimeException("[Platform Helper] Rendering window id is not an instance of TextureView." +
"Please update your UI layer so that the video rendering view is a TextureView (or an instance of it)" +
"or enable compatibility mode by setting displaytype=MSAndroidOpenGLDisplay in the [video] section your linphonerc factory configuration file" +
"so you can keep using your existing application code for managing video views.");
}
TextureView textureView = (TextureView)view;
textureView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
@Override
......@@ -430,6 +445,7 @@ public class AndroidPlatformHelper {
}
});
if (textureView.isAvailable()) {
Log.i("[Platform Helper] Rendering window surface is available");
mSurfaceTexture = textureView.getSurfaceTexture();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment