ScreenCaptureParameters
屏幕共享的参数配置。
Java
public class ScreenCaptureParameters {
public static class VideoCaptureParameters {
public int bitrate = 0;
public int framerate = 15;
public int width = 1280;
public int height = 720;
public int contentHint = Constants.SCREEN_CAPTURE_CONTENT_HINT_MOTION;
@CalledByNative("VideoCaptureParameters")
public int getBitrate() {
return bitrate;
}
@CalledByNative("VideoCaptureParameters")
public int getFramerate() {
return framerate;
}
@CalledByNative("VideoCaptureParameters")
public int getWidth() {
return width;
}
@CalledByNative("VideoCaptureParameters")
public int getHeight() {
return height;
}
@CalledByNative("VideoCaptureParameters")
public int getContentHint() {
return contentHint;
}
@Override
public String toString() {
return "VideoCaptureParameters{"
+ "bitrate=" + bitrate + ", framerate=" + framerate + ", width=" + width
+ ", height=" + height + ", contentHint=" + contentHint + '}';
}
}
public static class AudioCaptureParameters {
public int sampleRate = 16000;
public int channels = 2;
public int captureSignalVolume = 100;
public boolean allowCaptureCurrentApp = true;
@CalledByNative("AudioCaptureParameters")
public int getSampleRate() {
return sampleRate;
}
@CalledByNative("AudioCaptureParameters")
public int getChannels() {
return channels;
}
@CalledByNative("AudioCaptureParameters")
public int getCaptureSignalVolume() {
return captureSignalVolume;
}
@Override
public String toString() {
return "AudioCaptureParameters{"
+ "sampleRate=" + sampleRate + ", channels=" + channels + ", captureSignalVolume="
+ captureSignalVolume + ", allowCaptureCurrentApp=" + allowCaptureCurrentApp + '}';
}
}
public boolean captureAudio = false;
public VideoCaptureParameters videoCaptureParameters = new VideoCaptureParameters();
public boolean captureVideo = true;
public AudioCaptureParameters audioCaptureParameters = new AudioCaptureParameters();
@CalledByNative
public boolean isCaptureAudio() {
return captureAudio;
}
@CalledByNative
public VideoCaptureParameters getVideoCaptureParameters() {
return videoCaptureParameters;
}
@CalledByNative
public boolean isCaptureVideo() {
return captureVideo;
}
@CalledByNative
public AudioCaptureParameters getAudioCaptureParameters() {
return audioCaptureParameters;
}
@Override
public String toString() {
return "ScreenCaptureParameters{"
+ "captureAudio=" + captureAudio + ", videoCaptureParameters=" + videoCaptureParameters
+ ", captureVideo=" + captureVideo + ", audioCaptureParameters=" + audioCaptureParameters
+ '}';
}
}
captureAudio
屏幕共享时是否采集系统音频:
true
: 采集系统音频。false
: (默认)不采集系统音频。
信息
- 受系统限制,采集系统音频仅适用于 Android API 级别为 29 及以上,即 Android 10 及以上。
- 为提高屏幕共享时采集系统音频的成功率,请确保你已调用 setAudioScenario 方法并设置音频场景为
AUDIO_SCENARIO_GAME_STREAMING
。
captureVideo
屏幕共享时是否采集屏幕:
true
:(默认)采集屏幕。false
: 不采集屏幕。
信息
受系统限制,采集屏幕仅适用于 Android API 级别为 21 及以上,即 Android 5 及以上。
类
VideoCaptureParameters
共享屏幕流的视频编码配置。详见 VideoCaptureParameters。
AudioCaptureParameters
共享屏幕流的音频编码配置。详见 AudioCaptureParameters。