WebRTC、捕获屏幕

2024-02-03

我当前的问题是,我想找到一种在 Android 上的 webrtc 连接期间捕获帧/屏幕截图的方法。我知道这里已经有一些解决方案,但没有一个对我有用。

按照我目前的方法,我遵循了这个Gist https://gist.github.com/EricDavies/860c9a73d53649f7399e2a4a02fcb9da.

问题是它返回黑色位图。我将附加我的方法,但它基本上与要点相同。如果有人有任何想法如何解决这个问题,请提前致谢。

Activity SingleFrameCapturer.BitmapListener gotFrameListener = new 
    SingleFrameCapturer.BitmapListener() {

    @Override
    public void gotBitmap(Bitmap theBitmap) {
        Log.e(TAG, "got bitmap!");

        ImageView imageView = findViewById(R.id.object_preview);
        imageView.setImageBitmap(theBitmap);

        imageView.setVisibility(View.VISIBLE);
            }
        };

        MediaStream stream = contextManager.getStream();
        SingleFrameCapturer.toBitmap(this, stream, gotFrameListener);
    }
}

单帧捕捉器

import android.graphics.Bitmap;
import android.util.Base64;
import android.util.Log;
import java.nio.ByteBuffer;

import org.webrtc.VideoTrack;
import org.webrtc.MediaStream;
import org.webrtc.EglBase;
import org.webrtc.RendererCommon;

import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;

public class SingleFrameCapturer {

    public interface BitmapListener {
        public void gotBitmap(Bitmap theBitmap);
    }

    private static boolean firstTimeOnly = true;


    // the below pixelBuffer code is based on from
    // https://github.com/CyberAgent/android-gpuimage/blob/master/library/src/jp/co/cyberagent/android/gpuimage/PixelBuffer.java
    //
    class PixelBuffer implements org.webrtc.VideoRenderer.Callbacks {
        final static String TAG = "PixelBuffer";
        final static boolean LIST_CONFIGS = false;

        int mWidth, mHeight;
        EGL10 mEGL;
        EGLDisplay mEGLDisplay;
        boolean gotFrame = false;
        String mThreadOwner;
        BitmapListener listener;
        android.app.Activity activity;


        public PixelBuffer(android.app.Activity activity, BitmapListener listener) {
            this.listener = listener;
            this.activity = activity;
        }


        private static final String VERTEX_SHADER_STRING =
                "varying vec2 interp_tc;\n"
                        + "attribute vec4 in_pos;\n"
                        + "attribute vec4 in_tc;\n"
                        + "\n"
                        + "uniform mat4 texMatrix;\n"
                        + "\n"
                        + "void main() {\n"
                        + "    gl_Position = in_pos;\n"
                        + "    interp_tc = (texMatrix * in_tc).xy;\n"
                        + "}\n";


        @Override
        public void renderFrame(final org.webrtc.VideoRenderer.I420Frame i420Frame) {
            Log.d(TAG, "entered renderFrame");
            //
            // we only want to grab a single frame but our method may get called
            // a few times before we're done.
            //
            if (gotFrame || i420Frame.width == 0 || i420Frame.height == 0) {
                Log.d(TAG, "Already got frame so taking honourable exit");
                org.webrtc.VideoRenderer.renderFrameDone(i420Frame);
                return;
            }
            activity.runOnUiThread(new Runnable() {
                public void run() {
                    int width = i420Frame.width;
                    int height = i420Frame.height;
                    Log.d(TAG, "about to call initWithSize");
                    initWithSize(width, height);
                    Bitmap bitmap = toBitmap(i420Frame);
                    org.webrtc.VideoRenderer.renderFrameDone(i420Frame);
                    gotFrame = true;
                    listener.gotBitmap(bitmap);
                    destroy();
                }
            });
        }

        private int buildARGB(int r, int g, int b) {
            return (0xff << 24) |(r << 16) | (g << 8) | b;
        }

        private Bitmap toBitmap(org.webrtc.VideoRenderer.I420Frame frame) {

            if (frame.yuvFrame) {

                //EglBase eglBase = EglBase.create();
                EglBase eglBase = StreamActivity.rootEglBase;

                if(firstTimeOnly) {
                    eglBase.createDummyPbufferSurface();
                    firstTimeOnly = false;
                }
                eglBase.makeCurrent();
                TextureToRGB textureToRGB = new TextureToRGB();
                int numPixels = mWidth *mHeight;
                final int bytesPerPixel = 4;
                ByteBuffer framebuffer = ByteBuffer.allocateDirect(numPixels*bytesPerPixel);

                final float frameAspectRatio = (float) frame.rotatedWidth() / (float) frame.rotatedHeight();

                final float[] rotatedSamplingMatrix =
                        RendererCommon.rotateTextureMatrix(frame.samplingMatrix, frame.rotationDegree);
                final float[] layoutMatrix = RendererCommon.getLayoutMatrix(
                        false, frameAspectRatio, (float) mWidth / mHeight);
                final float[] texMatrix = RendererCommon.multiplyMatrices(rotatedSamplingMatrix, layoutMatrix);

                textureToRGB.convert(framebuffer, mWidth, mHeight, frame.textureId, texMatrix);

                byte [] frameBytes = framebuffer.array();
                int [] dataARGB = new int[numPixels];
                for(int i = 0, j = 0; j < numPixels; i+=bytesPerPixel, j++) {
                    //
                    // data order in frameBytes is red, green, blue, alpha, red, green, ....
                    //
                    dataARGB[j] = buildARGB(frameBytes[i] & 0xff,frameBytes[i+1] &0xff,frameBytes[i+2] &0xff);
                }

                Bitmap bitmap = Bitmap.createBitmap(dataARGB, mWidth, mHeight, Bitmap.Config.ARGB_8888);
                return bitmap;
            }
            else {
                return null;
            }
        }

        private void initWithSize(final int width, final int height) {
            mWidth = width;
            mHeight = height;

            // Record thread owner of OpenGL context
            mThreadOwner = Thread.currentThread().getName();
        }


        public void destroy() {
        }


        private int getConfigAttrib(final EGLConfig config, final int attribute) {
            int[] value = new int[1];
            return mEGL.eglGetConfigAttrib(mEGLDisplay, config,
                    attribute, value) ? value[0] : 0;
        }
    }


    final private static String TAG = "SingleFrameCapturer";
    org.webrtc.VideoRenderer renderer;

    private  SingleFrameCapturer(final android.app.Activity activity, MediaStream mediaStream, final BitmapListener gotFrameListener) {
        if( mediaStream.videoTracks.size() == 0) {
            Log.e(TAG, "No video track to capture from");
            return;
        }

        final VideoTrack videoTrack = mediaStream.videoTracks.get(0);
        final PixelBuffer vg = new PixelBuffer(activity, new BitmapListener() {

            @Override
            public void gotBitmap(final Bitmap bitmap) {
                activity.runOnUiThread(new Runnable(){
                    public void run() {
                        videoTrack.removeRenderer(renderer);
                        try {
                            gotFrameListener.gotBitmap(bitmap);
                        } catch( Exception e1) {
                            Log.e(TAG, "Exception in gotBitmap callback:" + e1.getMessage());
                            e1.printStackTrace(System.err);
                        }
                    }
                });

            }
        });
        renderer = new org.webrtc.VideoRenderer(vg);
        videoTrack.addRenderer(renderer);
    }

    /**
     * This constructor builds an object which captures a frame from mediastream to a Bitmap.
     * @param mediaStream The input media mediaStream.
     * @param gotFrameListener A callback which will receive the Bitmap.
     */
    public static void toBitmap(android.app.Activity activity, MediaStream mediaStream, final BitmapListener gotFrameListener) {
        new SingleFrameCapturer(activity, mediaStream, gotFrameListener);
    }

    /**
     * This method captures a frame from the supplied media stream to a jpeg file written to the supplied outputStream.
     * @param mediaStream  the source media stream
     * @param quality the quality of the jpeq 0 to 100.
     * @param outputStream the output stream the jpeg file will be written to.
     * @param done a runnable that will be invoked when the outputstream has been written to.
     * @return The frame capturer. You should keep a reference to the frameCapturer until the done object is invoked.
     */
    public static void toOutputStream(android.app.Activity activity, MediaStream mediaStream, final int quality, final java.io.OutputStream outputStream, final Runnable done) {
        BitmapListener gotFrameListener = new BitmapListener() {

            @Override
            public void gotBitmap(Bitmap theBitmap) {
                theBitmap.compress(Bitmap.CompressFormat.JPEG, quality, outputStream);
                try {
                    done.run();
                } catch( Exception e1) {
                    Log.e(TAG, "Exception in toOutputStream done callback:" + e1.getMessage());
                    e1.printStackTrace(System.err);
                }

            }
        };
        toBitmap(activity, mediaStream, gotFrameListener);
    }

    /**
     * This method captures a frame from the supplied mediastream to a dataurl written to a StringBuilder.
     * @param mediaStream  the source media stream
     * @param quality the quality of the jpeq 0 to 100.
     * @param output a StringBuilder which will be the recipient of the dataurl.
     * @param done a runnable that will be invoked when the dataurl is built.
     * @return The frame capturer. You should keep a reference to the frameCapturer until the done object is invoked.
     */
    public static void toDataUrl(android.app.Activity activity, MediaStream mediaStream, final int quality, final StringBuilder output, final Runnable done) {

        final java.io.ByteArrayOutputStream outputStream = new java.io.ByteArrayOutputStream();
        Runnable convertToUrl = new Runnable() {

            @Override
            public void run() {
                output.append("data:image/jpeg;base64,");
                output.append(Base64.encodeToString(outputStream.toByteArray(), Base64.DEFAULT));
                try {
                    done.run();
                } catch( Exception e1) {
                    Log.e(TAG, "Exception in toDataUrl done callback:" + e1.getMessage());
                    e1.printStackTrace(System.err);
                }
            }
        };
        toOutputStream(activity, mediaStream, quality, outputStream, convertToUrl);
    }
}

纹理转RGB

import android.opengl.GLES11Ext;
import android.opengl.GLES20;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import org.webrtc.*;
/**
 * Class for converting OES textures RGBA. It should be constructed on a thread with
 * an active EGL context, and only be used from that thread. It is used by the EasyrtcSingleFrameCapturer.
 */
public class TextureToRGB {
    // Vertex coordinates in Normalized Device Coordinates, i.e.
    // (-1, -1) is bottom-left and (1, 1) is top-right.
    private static final FloatBuffer DEVICE_RECTANGLE = GlUtil.createFloatBuffer(new float[] {
            -1.0f, -1.0f, // Bottom left.
            1.0f, -1.0f, // Bottom right.
            -1.0f, 1.0f, // Top left.
            1.0f, 1.0f, // Top right.
    });

    // Texture coordinates - (0, 0) is bottom-left and (1, 1) is top-right.
    private static final FloatBuffer TEXTURE_RECTANGLE = GlUtil.createFloatBuffer(new float[] {
            0.0f, 0.0f, // Bottom left.
            1.0f, 0.0f, // Bottom right.
            0.0f, 1.0f, // Top left.
            1.0f, 1.0f // Top right.
    });


    private static final String VERTEX_SHADER =
            "varying vec2 interp_tc;\n"
                    + "attribute vec4 in_pos;\n"
                    + "attribute vec4 in_tc;\n"
                    + "\n"
                    + "uniform mat4 texMatrix;\n"
                    + "\n"
                    + "void main() {\n"
                    + "    gl_Position = in_pos;\n"
                    + "    interp_tc = (texMatrix * in_tc).xy;\n"
                    + "}\n";

    private static final String FRAGMENT_SHADER =
            "#extension GL_OES_EGL_image_external : require\n"
                    + "precision mediump float;\n"
                    + "varying vec2 interp_tc;\n"
                    + "\n"
                    + "uniform samplerExternalOES oesTex;\n"
                    + "\n"
                    + "void main() {\n"
                    + "  gl_FragColor = texture2D(oesTex, interp_tc);\n"
                    + "}\n";
    // clang-format on

    private final GlTextureFrameBuffer textureFrameBuffer;
    private final GlShader shader;
    private final int texMatrixLoc;
    private final ThreadUtils.ThreadChecker threadChecker = new ThreadUtils.ThreadChecker();
    private boolean released = false;

    /**
     * This class should be constructed on a thread that has an active EGL context.
     */
    public TextureToRGB() {
        threadChecker.checkIsOnValidThread();
        textureFrameBuffer = new GlTextureFrameBuffer(GLES20.GL_RGBA);
        shader = new GlShader(VERTEX_SHADER, FRAGMENT_SHADER);
        shader.useProgram();
        texMatrixLoc = shader.getUniformLocation("texMatrix");

        GLES20.glUniform1i(shader.getUniformLocation("oesTex"), 0);
        GlUtil.checkNoGLES2Error("Initialize fragment shader uniform values.");
        // Initialize vertex shader attributes.
        shader.setVertexAttribArray("in_pos", 2, DEVICE_RECTANGLE);
        // If the width is not a multiple of 4 pixels, the texture
        // will be scaled up slightly and clipped at the right border.
        shader.setVertexAttribArray("in_tc", 2, TEXTURE_RECTANGLE);
    }

    public void convert(ByteBuffer buf, int width, int height, int srcTextureId,
                        float[] transformMatrix) {
        threadChecker.checkIsOnValidThread();
        if (released) {
            throw new IllegalStateException("TextureToRGB.convert called on released object");
        }

        int size = width * height;
        if (buf.capacity() < size) {
            throw new IllegalArgumentException("TextureToRGB.convert called with too small buffer");
        }
        // Produce a frame buffer starting at top-left corner, not
        // bottom-left.
        transformMatrix =
                RendererCommon.multiplyMatrices(transformMatrix, RendererCommon.verticalFlipMatrix());

        final int frameBufferWidth = width;
        final int frameBufferHeight =height;
        textureFrameBuffer.setSize(frameBufferWidth, frameBufferHeight);

        // Bind our framebuffer.
        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, textureFrameBuffer.getFrameBufferId());
        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, srcTextureId);
        GLES20.glUniformMatrix4fv(texMatrixLoc, 1, false, transformMatrix, 0);
        GLES20.glViewport(0, 0, width, height);

        GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

        GLES20.glReadPixels(
                0, 0, frameBufferWidth, frameBufferHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buf);

        // Restore normal framebuffer.
        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);

        // Unbind texture. Reportedly needed on some devices to get
        // the texture updated from the camera.
        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, 0);
        GlUtil.checkNoGLES2Error("TextureToRGB.convert");
    }

    public void release() {
        threadChecker.checkIsOnValidThread();
        released = true;
        shader.release();
        textureFrameBuffer.release();
    }
}

我刚刚为您的问题找到了解决方案,这就是您如何使用 SurfaceViewRenderer 在 Android 中获取 webrtc 调用的屏幕截图:

基本上,您必须创建一个自定义类来实现EGLRenderer.FrameListener,并使用它,<your_surface_view_renderer>.AddFrameListener(EGLRenderer.FrameListener listener, float scale).

然后,在onFrame你的班级的方法,你会得到一个Bitmap每帧的。不要忘记使用removeFrameListener later.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

WebRTC、捕获屏幕 的相关文章

  • 以编程方式将图像添加到RelativeLayout

    我想通过代码添加各种相对布局到线性布局 每个相对布局由以下部分组成 左侧的图像视图 右侧旁边的文本视图 正好在中间 以及右侧的另一个图像 我必须使用从数据库读取的数据来添加它们 它必须使用relativelayout 因为我想在图像上使用一
  • 在处理器生成的类中使用库

    我正在开发一个库来使用注释和处理器生成类 生成的类应该使用Gson来自谷歌的图书馆 我的问题是 我应该在哪里添加 Gson 依赖项 我目前正在将其添加到处理器 build gradle 中 但是当生成类时 找不到 Gson Android
  • 检测已退款的托管应用内购买 android IAP 2.0.3

    我无法弄清楚如何使用 Android 检测何时为托管 不可消费 应用内产品发放退款com android billingclient billing 2 0 3 这个问题似乎相当深 尽管我可能让它变得比应有的更复杂 首先 我进行了一次测试购
  • 在Android中获取Fragment中的应用程序上下文?

    我已通过在一个活动中使用应用程序上下文将一些数据存储到全局类中 稍后我必须在片段中检索这些值 我已经做了类似的事情来存储在全局类中 AndroidGlobalClass AGC AndroidGlobalClass getApplicati
  • Hibernate 验证器:违规消息语言

    我有一个测试类 我正在测试一个域模型 该模型用例如注释 NotNull 在我的测试课中 我首先得到验证器 private static Validator validator BeforeClass public static void s
  • 将列表视图项转换为单个位图图像

    参考这个主题 Android 获取所有 ListView 项目的屏幕截图 https stackoverflow com questions 12742343 android get screenshot of all listview i
  • 在JPA、关系型数据库等中,什么是Tuple? [关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 我正在研究 Hibernate 和 JPA 并且一直在寻找这个术语 有人可以用实用和说教的方式向我解释一下这个术语是什么 以及它与 J
  • 如何在对话框中显示/隐藏 Android 软键盘?

    在我的应用程序中 自定义对话框位于 BaseExpandableListAdapter 类中 在对话框中我有两个编辑文本 首先是名称及其强制性 其次是解决其可选问题 还有两个按钮 确定 和 取消 当对话框显示时 我想显示带有请求焦点的键盘以
  • 如何单击 TableLayout 中的特定 TableRow

    我制作了自己的复合控件 该控件使用 TableLayout 显示数据网格 并根据绑定到它的对象数组以编程方式在循环内添加 Tablerows 现在我想选择具有特定数据的特定行 以便由一个方法 那么我如何选择检索其数据的特定行来委托方法呢 你
  • 如何动态更新属性文件?

    我的应用程序是一个批处理过程 它从 application properties 文件中提取环境变量 我使用的密码必须每隔几个月更新一次 我想自动化密码更新过程并将更新后的密码保存在属性文件中 以便在将来的运行中使用 但我尝试进行的任何更新
  • 如何使用 Spring 状态机在状态转换期间引发异常

    我试图了解状态转换期间操作如何抛出异常 我配置了这个简单的状态机 transitions withExternal source State A1 target State A2 event Event E1 action executeA
  • Android 有类似 mechanize 这样的工具吗? [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 我正在创建一个 Android 应用程序 它必须在后台进行一些网上冲浪 以便为用户提供服务 我必须连接
  • android中textview截断一个字母

    这是我的 Android 设备的屏幕截图 文字是 asd 然而 d 被稍微切断了 这是相关视图
  • 在java中读取文本文件[关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 当每行都包含整数 字符串和双精度数时 如何在 Java 中读取 txt 文件并将每一行放入数组中 每行都有不同数量的单词 数字 Try
  • 全屏 Exoplayer

    我尝试用以下内容显示节目视频 mp4 外播放器 in 回收视图 and 浏览器 我展示了具有自定义布局的视频控制器 到目前为止 一切都很好 现在尝试像其他视频播放器一样全屏播放视频 但在中找不到好方法外播放器 doc 谁能帮我 ExoPla
  • 为什么我在模拟器中看不到视频?

    我见过几个与此类似的问题 但我想确定一下 我无法在模拟器上运行视频 是否一致 有人在模拟器上成功运行视频吗 以下是我使用的代码 import android app Activity import android net Uri impor
  • Android Google Maps API OnLocationChanged 仅调用一次

    每当我的位置发生变化时 我都会尝试更新我的相机 然而 onLocationChanged 只被调用一次 当我随后在模拟器中发送新位置时 不会调用 onLocationChanged 我已经尝试了几个小时了 但似乎无法修复它 public c
  • 生成最终存档时出错:无法获取调试签名密钥

    我无法在 mac 10 7 上使用 Eclipse 构建和运行我的 android 项目 我收到的错误是 生成最终存档时出错 无法获取调试签名密钥 更改 android 目录中的权限没有成功 尝试生成另一个项目 按照设置 SDK 的指南 甚
  • 如何在Android中将外部jar文件包含到aar文件中

    我想开发一个解决方案 允许我在 Android 项目的 aar 文件中生成的 SDK 中使用外部 jar 库 我有什么输入 SDK de xx sdk xxx android v1 0 0 外部库 libs xxxx v1 0 0 我在调查
  • 是否有可能构建一个可以通过浏览器运行的网络自动化?

    我创建了一个 Java 程序 它使用镀铬驱动程序 https chromedriver chromium org Selenium https www seleniumhq org and Java Excel API http jexce

随机推荐

  • 在seaborn中绘制带有孵化的堆积条形图

    我正在尝试使用带有孵化功能的seaborn matplotlib 绘制堆积条形图 但孵化不合适 如图所示 我的代码如下 sc bar sns barplot x Salt Concentration y EPS Produced data
  • Spring 元素必须指定引用或值

    我在 Spring 和构造函数注入方面遇到问题 我想动态创建具有名称的对象 String 和特殊 ID long 但是当加载 spring xml 文件时会发生异常 线程 main 中的异常 java lang ExceptionInIni
  • 将弹出窗口置于前面

    在我的应用程序中 我有一个弹出窗口 其中包含当我选择某些选项时打开的信息 第一次还可以 在所有内容前面弹出突出显示 但是 当它失去焦点时 当用户转到其他窗口时 如果用户再次单击同一选项 我希望弹出窗口再次显示在所有内容的前面 我尝试过类似的
  • iPhone 应用程序的分发(App Store)版本中出现错误

    我创建了一个具有自建照片工具的应用程序 当我测试 调试和临时 时 它工作正常 它是使用 UIScrollView 构建的 并在照片的插槽滚动到屏幕上时将每个照片添加到 UIScroll 视图 但现在该应用程序已在 App Store 中 并
  • 具有多个命令的 Git 别名的语法[重复]

    这个问题在这里已经有答案了 我想创建一个 Git 别名来执行多个命令 但我找不到有关如何完成此操作的文档 具有多个命令的 Git 别名的语法是什么 这是在哪里记录的 来自 man git config alias git 1 命令包装器的命
  • 如何向 R Shiny 表添加行

    我正在尝试使用 R Shiny 构建一个表单 一旦单击表单末尾的操作按钮 它将用于填充表格 我无法弄清楚如何获取表单中的数据并将其添加到表中的新行中 现在 它只是用表单中的任何内容不断更新第一行 我在这里重现了代码的简单版本 ui r li
  • UITabBarController 中的 UIViewController 和 UISplitViewController shouldAutorotateToInterfaceOrientation

    我的 iPad 代码有一些问题 我有一个 UITabBarController 其中包含一些 UIViewController 和 UISplitViewController 问题是 UIViewController 甚至 UISplitV
  • 使用 Javascript 动态创建具有递增 ID 的 dom 元素

    我有一个 ID 为 orangeButton 的 div 每次单击它时都会创建一个新的 div 这工作正常 但是 我希望每个新创建的 div 都有一个增量编号添加到它的 ID 中 我不知道该怎么做 这是我迄今为止带有注释的代码的小提琴 ht
  • Inno Setup 安装 - 访问被拒绝

    我已经使用 inno setup 创建了一个安装 我的应用程序 除其他外 运行后会在子文件夹中创建一个 pdf 文件 然后打开它 但 Windows 7 说访问被拒绝并弹出异常 怎么了 如何使用 innosetup 授予对子文件夹的访问权限
  • 在 python 中处理 try except 的更简洁的方法

    所以 假设我有 3 个不同的调用something something1 and something2 现在 我称之为 try something something1 something2 except Keyerror as e pri
  • VS2012中“从源代码管理中排除”发生了什么

    我想从 TFS 2012 源代码管理中排除代码文件夹中的某些文件 在 VS2012 之前 这是通过 源代码管理资源管理器 右键菜单中的 从源代码管理中排除 命令来完成的 但在VS2012中我找不到它 有人知道它在哪里吗 顺便说一句 我正在使
  • 将类型限制为特定类型

    是否可以将泛型方法限制在特定类型上 我想写这样的东西 public T GetValue
  • 如何在Android中使用SetGroup()在组中显示通知?

    我尝试过使用 0 通知 ID 以及唯一的通知 ID 还使用了 setGroup 如下所示 它仍然每次都会生成一个新的通知 我想合并通知正文并将标题设置为通用 class MyFirebaseMessagingService Firebase
  • 正则表达式非捕获组 - 无用?

    我试图理解这个概念 但我真的看不出它有什么用 所以我假设我没有抓住重点 例如 这个正则表达式 0 9 st nd rd th 将匹配带或不带 st rd 等后缀的数字 So 1st match 0 9 st nd rd th g 返回 第一
  • 如何在 R 中导出 GBM 模型?

    是否有标准 或可用 方法在 R 中导出 GBM 模型 PMML 可以工作 但是当我尝试使用 pmml 库时 可能是错误的 我收到错误 例如 我的代码看起来类似于 library gbm library pmml model lt gbm f
  • VSCode:用户设置中的 TextMate 正则表达式

    我正在尝试更改主题以更适合我的日常使用 但在尝试自定义特定单词或模式时遇到了一些麻烦 我现在正在使用这种格式 editor tokenColorCustomizations textMateRules scope comment setti
  • 如何使用 Spark 计算累积和

    我有一个 String Int 的 rdd 它按键排序 val data Array c1 6 c2 3 c3 4 val rdd sc parallelize data sortByKey 现在我想以零开始第一个键的值 并将后续键作为先前
  • Eclipse 中的 Jetty 8.1.1.v20120215 和 web 应用程序 (JSF + Maven)

    我正在尝试在 Eclipse 中运行我的 web 应用程序 使用 JSf Jetty 8 1 1 v20120215 我下载了 Jetty Adapter 然后在 Eclipse 中添加了 Jetty Server 8 1 然后我在 Jet
  • 如何开始使用 Perl 进行网页抓取?

    我有兴趣学习 Perl 我正在使用 Learning Perl 书籍和 cpan 的网站作为参考 我期待着使用 Perl 做一些网页 文本抓取应用程序来应用我所学到的东西 请建议我一些好的选择 这不是家庭作业 想要在 Perl 中做一些事情
  • WebRTC、捕获屏幕

    我当前的问题是 我想找到一种在 Android 上的 webrtc 连接期间捕获帧 屏幕截图的方法 我知道这里已经有一些解决方案 但没有一个对我有用 按照我目前的方法 我遵循了这个Gist https gist github com Eri