API リファレンス

画面ミラーリング

機能の対応状況は app.capabilities、認可は app.access とホストの権限で確認してください。例は合成値を使用しています。呼び出す前にパス、ID、入力、フィルターを置き換えてください。

型定義

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
}

操作

subscription

screenMirrorState

現在の画面ミラーリング状態を読み取ります。

graphql
subscription screenMirrorState {
  screenMirrorState { running }
}
subscription

screenMirrorVideoCodec

画面ミラーリングセッションの動画コーデック設定の更新を受信します。

graphql
subscription screenMirrorVideoCodec {
  screenMirrorVideoCodec { annexB }
}
subscription

screenMirrorAudioGranted

画面ミラーリング音声の権限が許可された通知を受信します。

graphql
subscription screenMirrorAudioGranted {
  screenMirrorAudioGranted
}
mutation

openAccessibilitySettings

デバイス上で Android のユーザー補助設定画面を開きます。sendScreenMirrorControl がジェスチャーを送る前に必要です。

graphql
mutation openAccessibilitySettings {
  openAccessibilitySettings
}
mutation

requestScreenMirrorAudio

画面ミラーリング音声用のマイク権限を要求します。すでに許可されていれば true、それ以外は false を返し、権限ダイアログを表示します。

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

実行中の画面ミラーリング動画エンコーダーに新しいキーフレームを要求します。

graphql
mutation requestScreenMirrorKeyFrame {
  requestScreenMirrorKeyFrame
}
mutation

startScreenMirror

画面ミラーリングセッションを開始します。デバイス音声も配信するには audio=true を渡します(RECORD_AUDIO 権限が必要)。

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

stopScreenMirror

実行中の画面ミラーリングセッションを停止します。

graphql
mutation stopScreenMirror {
  stopScreenMirror
}
mutation

updateScreenMirrorQuality

画面ミラーリングの画質プリセットを設定します。

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

isScreenMirroring

画面ミラーリングセッションが実行中かを確認します。

graphql
query isScreenMirroring {
  isScreenMirroring
}
query

screenMirrorControlEnabled

PlainApp のユーザー補助サービスが有効で、ジェスチャーを送れる場合は true を返します。

graphql
query screenMirrorControlEnabled {
  screenMirrorControlEnabled
}
query

screenMirrorQuality

現在のミラーリング画質プリセットを取得します。

graphql
query screenMirrorQuality {
  screenMirrorQuality { mode resolution }
}
query

screenMirrorVideoCodec

現在または直前のミラーリングセッションで使用した動画コーデックを取得します。

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