Tham chiếu API

Phản chiếu màn hình

Kiểm tra app.capabilities để biết tính năng và app.access cùng quyền máy chủ để xác định quyền truy cập. Thay giá trị mẫu trước khi gọi.

Định nghĩa kiểu

graphql
type Subscription {
  screenMirrorState: MirrorState!
  screenMirrorVideoCodec: MirrorCodecConfiguration
  screenMirrorAudioGranted: Boolean!
}

type Mutation {
  openAccessibilitySettings: Boolean!
  requestScreenMirrorAudio: Boolean!
  requestScreenMirrorKeyFrame: Boolean!
  startScreenMirror(audio: Boolean!): Boolean!
  stopScreenMirror: Boolean!
  updateScreenMirrorQuality(mode: ScreenMirrorMode!): Boolean!
}

type Query {
  isScreenMirroring: Boolean!
  screenMirrorControlEnabled: Boolean!
  screenMirrorQuality: ScreenMirrorQuality!
  screenMirrorVideoCodec: ScreenMirrorVideoCodec
}

type MirrorCodecConfiguration {
	annexB: String!
}

type MirrorState {
	running: Boolean!
}

enum ScreenMirrorMode {
	HD
	SMOOTH
}

type ScreenMirrorQuality {
	mode: ScreenMirrorMode!
	resolution: Int!
}

type ScreenMirrorVideoCodec {
	
	annexB: String!
	
	keyFrame: String
}

Thao tác

subscription

screenMirrorState

Đọc trạng thái phản chiếu màn hình hiện tại.

graphql
subscription screenMirrorState {
  screenMirrorState { running }
}
subscription

screenMirrorVideoCodec

Nhận cập nhật cấu hình bộ mã hóa video của phiên phản chiếu màn hình.

graphql
subscription screenMirrorVideoCodec {
  screenMirrorVideoCodec { annexB }
}
subscription

screenMirrorAudioGranted

Nhận thông báo quyền âm thanh phản chiếu màn hình đã được cấp.

graphql
subscription screenMirrorAudioGranted {
  screenMirrorAudioGranted
}
mutation

openAccessibilitySettings

Mở màn hình cài đặt Trợ năng Android trên thiết bị. Cần thực hiện trước khi sendScreenMirrorControl có thể gửi cử chỉ.

graphql
mutation openAccessibilitySettings {
  openAccessibilitySettings
}
mutation

requestScreenMirrorAudio

Yêu cầu quyền micrô cho âm thanh phản chiếu màn hình. Trả về true nếu đã cấp, nếu không trả false (và mở hộp thoại quyền).

graphql
# Returns false when the device has not granted RECORD_AUDIO yet; the
# platform asks for it and the caller retries.
mutation requestScreenMirrorAudio {
  requestScreenMirrorAudio
}
mutation

requestScreenMirrorKeyFrame

Yêu cầu khung hình chính mới từ bộ mã hóa video phản chiếu màn hình đang hoạt động.

graphql
mutation requestScreenMirrorKeyFrame {
  requestScreenMirrorKeyFrame
}
mutation

startScreenMirror

Bắt đầu phiên phản chiếu màn hình. Truyền audio=true để truyền cả âm thanh thiết bị (yêu cầu quyền RECORD_AUDIO).

graphql
mutation startScreenMirror($audio: Boolean!) {
  startScreenMirror(audio: $audio)
}
mutation

stopScreenMirror

Dừng phiên phản chiếu màn hình đang hoạt động.

graphql
mutation stopScreenMirror {
  stopScreenMirror
}
mutation

updateScreenMirrorQuality

Đặt cấu hình chất lượng phản chiếu màn hình.

graphql
mutation updateScreenMirrorQuality($mode: ScreenMirrorMode!) {
  updateScreenMirrorQuality(mode: $mode)
}
query

isScreenMirroring

Kiểm tra phiên phản chiếu màn hình có đang hoạt động không.

graphql
query isScreenMirroring {
  isScreenMirroring
}
query

screenMirrorControlEnabled

Trả về true khi dịch vụ Trợ năng PlainApp được bật và có thể gửi cử chỉ.

graphql
query screenMirrorControlEnabled {
  screenMirrorControlEnabled
}
query

screenMirrorQuality

Lấy cấu hình chất lượng phản chiếu hiện tại.

graphql
query screenMirrorQuality {
  screenMirrorQuality { mode resolution }
}
query

screenMirrorVideoCodec

Lấy codec video dùng trong phiên phản chiếu hiện tại/cuối cùng.

graphql
# Null while the pipeline has not published its codec configuration.
query screenMirrorVideoCodec {
  screenMirrorVideoCodec { annexB keyFrame }
}