首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >bringToFront不工作在GLsurface视图的情况下

bringToFront不工作在GLsurface视图的情况下
EN

Stack Overflow用户
提问于 2020-09-02 08:24:24
回答 1查看 63关注 0票数 0

在我的应用程序中,我使用openTok作为音频和视频调用功能。附件是我正在创建的图像,用于视频调用,以旋转摄像机视图,有一个摄像机旋转图标。

在发布流之前,这个图标到旋转相机的位置是一样的,但是一旦流被发布,这个图标就消失了。它之所以发生,是因为z阶。如下所述的发布流的代码:

代码语言:javascript
运行
AI代码解释
复制
    private void startPublisherStreaming() {
    mPublisher = new Publisher.Builder(getContext())
            .resolution(Publisher.CameraCaptureResolution.LOW)
            .frameRate(Publisher.CameraCaptureFrameRate.FPS_7)
            .name(name)
            .build();
    mPublisher.setPublisherListener(VideoCallFragment.this);
    mPublisher.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL);
    mPublisher.setPublishAudio(true);
    mPublisher.setPublishVideo(true);
    flSubStream.addView(mPublisher.getView());

    if (mPublisher.getView() instanceof GLSurfaceView) {
        ((GLSurfaceView) mPublisher.getView()).setZOrderOnTop(true);
    }

    ivFlipCamera.bringToFront();
    mSession.publish(mPublisher);
}

一旦眩光表面得到渲染,它就会出现在顶部,旋转图标就会返回。为了恢复图标,我使用的是bringtoFront(),但这不起作用。下面是用于布局的xml。

代码语言:javascript
运行
AI代码解释
复制
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/cl_frag_audio_call"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/main_bg">

<FrameLayout
    android:id="@+id/container_main_streaming"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<TextView
    android:id="@+id/tv_call_time"
    style="@style/NormalTextView"
    android:layout_width="0dp"
    android:layout_height="@dimen/height_call_timer"
    android:layout_marginTop="4dp"
    android:background="@color/colorTransBlack"
    android:gravity="center"
    android:text="@string/dummy_call_duration"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<androidx.constraintlayout.widget.ConstraintLayout
    android:padding="@dimen/default_app_margin"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="@dimen/default_quarter_app_margin"
    android:background="@color/colorTransBlack"
    app:layout_constraintBottom_toTopOf="@+id/group"
    app:layout_constraintStart_toStartOf="parent">

    <RelativeLayout
        android:id="@+id/container_stream"
        android:layout_width="@dimen/sub_streaming_size"
        android:layout_height="@dimen/sub_streaming_size"
        app:layout_constraintBottom_toTopOf="@+id/tv_stream_name"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

    </RelativeLayout>

    <ImageView
        android:id="@+id/iv_flip_camera"
        android:layout_width="@dimen/camera_flip_size"
        android:layout_height="@dimen/camera_flip_size"
        android:src="@drawable/call_camera_flip_ico"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/tv_stream_name"
        style="@style/SmallTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/default_half_app_margin"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
    android:id="@+id/group"
    android:layout_width="match_parent"
    android:layout_height="@dimen/calling_options_group_height"
    android:background="@color/colorTransBlack"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent">


    <ImageView
        android:tag="1"
        android:id="@+id/iv_video_switch"
        android:layout_width="@dimen/calling_option_size"
        android:layout_height="@dimen/calling_option_size"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/iv_speaker"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/call_vid_ico" />

    <ImageView
        android:id="@+id/iv_mic"
        android:layout_width="@dimen/calling_option_size"
        android:layout_height="@dimen/calling_option_size"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/iv_chat"
        app:layout_constraintStart_toEndOf="@+id/iv_speaker"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/call_mic_ico" />

    <ImageView
        android:id="@+id/iv_chat"
        android:layout_width="@dimen/calling_option_size"
        android:layout_height="@dimen/calling_option_size"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/iv_add_user"
        app:layout_constraintStart_toEndOf="@+id/iv_mic"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/call_chat_dis_ico" />

    <ImageView
        android:id="@+id/iv_add_user"
        android:layout_width="@dimen/calling_option_size"
        android:layout_height="@dimen/calling_option_size"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/iv_end_call"
        app:layout_constraintStart_toEndOf="@+id/iv_chat"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/call_adduser_off_ico" />

    <ImageView
        android:id="@+id/iv_end_call"
        android:layout_width="@dimen/calling_option_size"
        android:layout_height="@dimen/calling_option_size"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/iv_add_user"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/call_incoming_reject_ico" />

    <ImageView
        android:id="@+id/iv_speaker"
        android:layout_width="@dimen/calling_option_size"
        android:layout_height="@dimen/calling_option_size"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/iv_mic"
        app:layout_constraintStart_toEndOf="@+id/iv_video_switch"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/call_speaker_ico_enable" />

</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

你知道如何在GLsurfaceview上引入旋转图标吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-09-03 00:22:04

一种选择是切换到使用TextureView而不是GLSurfaceView,一般来说,当使用TextureView而不是GLSurfaceView时,视图合成要容易得多。

在构建会话时,可以通过这样做来启用TextureView。

代码语言:javascript
运行
AI代码解释
复制
Session builder = new Session.Builder(this, apiKey, sessionId)
    .sessionOptions(new Session.SessionOptions() {
        @Override
        public boolean useTextureViews() {
            return true;
        }
    }).build();

欲了解更多信息,请阅读:https://tokbox.com/developer/sdks/android/reference/com/opentok/android/Session.SessionOptions.html#useTextureViews--

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63709672

复制
相关文章
jQuery - AJAX load() 方法
下面的例子会把文件 "demo_test.txt" 的内容加载到指定的 <div> 元素中:
陈不成i
2021/07/22
1.5K0
jquery中load的用法
调用load方法的完整格式是:load( url, [data], [callback] ),其中
OECOM
2020/07/01
1.1K0
延迟加载图片的jQuery插件-Lazy Load Plugin for JQuery
Lazy Load是一个用Javascript写得jQuery插件。它可以使一个长网页中,不在当前视图中的图片延迟加载,以提高页面的载入速度。
EltonZheng
2021/01/26
3.8K0
jQuery - AJAX 简介及AJAX load() 方法
简短地说,在不重载整个网页的情况下,AJAX 通过后台加载数据,并在网页上进行显示。
用户7718188
2021/10/07
1K0
pickle.load()函数
此函数和 dump() 函数相对应,用于将二进制对象文件转换成 Python 对象。该函数的基本语法格式为:
用户8442333
2021/11/30
9.3K0
Teamviewer显示“未就绪,请检查您的连接”解决办法
  打开TeamViewer一直提示“未就绪,请检查您的连接”,一直会弹出一个框提示检查网路设置什么。
_一级菜鸟
2019/09/10
13.6K0
Teamviewer显示“未就绪,请检查您的连接”解决办法
延迟加载图片的 jQuery 插件:Lazy Load
网站的速度非常重要,现在有很多网站优化的工具,如 Google 的 Page Speed,Yahoo 的 YSlow,对于网页图片,Yahoo 还提供 Smush.it 这个工具对图片进行批量压缩,但是对于图片非常多的网站,载入网页还是需要比较长的时间,这个时候我们可以使用 Lazy Load 这个 jQuery 插件来延迟加载图片。
Denis
2023/04/15
1.9K0
jquery中load中文乱码的解决方法
本文由 小马哥 创作,采用 知识共享署名4.0 国际许可协议进行许可
IT小马哥
2022/11/16
5290
jQuery遍历函数
.closest():从元素本身開始,逐级向上级元素匹配。并返回最先匹配的祖先元素。
全栈程序员站长
2022/07/07
1.1K0
【冷知识】jQuery 中load()方法页面显示空白bug
项目中,使用jquery中的load方法加载页面,一直不能实现。页面显示空白,也不提示错误。 代码如下:
用户9914333
2022/07/22
1.1K0
jQuery AJAX load()方法中代码执行顺序的问题
问题来源于菜鸟教程介绍 jQuery load() 方法时用的一个实例: JS:
Chor
2019/11/08
1.5K0
kubernetes就绪探针
Kubernetes中的就绪探针(readiness probe)是一种用于检查应用程序是否已准备好接收流量的机制。就绪探针可以帮助Kubernetes确保应用程序只有在准备好接收流量时才会被暴露给外部服务。
玖叁叁
2023/04/29
1.8K0
jquery定时执行函数_jquery自动提交
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
全栈程序员站长
2022/10/01
2.3K0
JQuery高级应用
toggle([speed],[easing],[fn]) :切换,显示则隐藏,隐藏则显示
乐心湖
2021/01/18
5.9K0
JQuery高级应用
layui布局 使用jquery的load后页面js失效
布局页面 H5在主体部分用jquery的load方法引入其他页面本页面js失效 <!DOCTYPE html> <html> <head> <meta charset="utf-8">
用户5899361
2020/12/07
2.6K0
layui布局 使用jquery的load后页面js失效
布局页面 H5在主体部分用jquery的load方法引入其他页面本页面js失效 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <title>layout 后台大布局 - Layui</title> <link rel="stylesheet" hr
用户5899361
2020/12/02
4.3K0
layui布局 使用jquery的load后页面js失效
Matlab数据导入--importdata和load函数
在使用matlab将数据导入到工作空间的时候,经常会使用到两个函数,一个是importdata函数,另一个是load函数,它们的使用方法和使用场景是太相同的,如果不太注意就可能会犯错误,在这里做简要的说明和记录。
用户9925864
2022/07/27
1.1K0
Matlab数据导入--importdata和load函数
jQuery的animate函数
jQuery提供了一个animate函数,可以通过改变CSS属性来实现一些动画效果。
大江小浪
2018/07/25
1.7K0
jQuery函数的使用
上述代码将从Google的CDN中加载jQuery库。确保将其放在<head>标签或页面内容的顶部。
堕落飞鸟
2023/05/18
1.5K0
点击加载更多

相似问题

jquery就绪函数未执行

21

jquery就绪函数在函数内部未命中

12

在jQuery .load()内容完全就绪后执行javascript函数

12

Jquery中未给出输出的就绪函数

11

在jquery循环幻灯片中使用load函数代替就绪函数

12
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文