MediaProjection.Callback.OnCapturedContentResize(Int32, Int32) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
キャプチャが開始された直後、またはキャプチャされたリージョンのサイズが変更されたときに呼び出され、ストリーム キャプチャの正確なサイズ設定が提供されます。
[Android.Runtime.Register("onCapturedContentResize", "(II)V", "GetOnCapturedContentResize_IIHandler", ApiSince=34)]
public virtual void OnCapturedContentResize (int width, int height);
[<Android.Runtime.Register("onCapturedContentResize", "(II)V", "GetOnCapturedContentResize_IIHandler", ApiSince=34)>]
abstract member OnCapturedContentResize : int * int -> unit
override this.OnCapturedContentResize : int * int -> unit
パラメーター
- width
- Int32
- height
- Int32
- 属性
注釈
キャプチャが開始された直後、またはキャプチャされたリージョンのサイズが変更されたときに呼び出され、ストリーム キャプチャの正確なサイズ設定が提供されます。
指定された幅と高さ (ピクセル単位) は、キャプチャされた領域から android.view.WindowMetrics#getBounds()
返されるのと同じ幅と高さに対応します。
記録されたコンテンツの縦横比 VirtualDisplay
が または 出力 Surface
とは異なる場合、キャプチャされたストリームには、記録されたコンテンツの周囲にレターボックス (黒いバー) があります。 アプリケーションでは、 と の両方の出力Surface
のサイズを更新することで、記録されたコンテンツのレターボックス化をVirtualDisplay
回避できます。
@Override
public String onCapturedContentResize(int width, int height) {
// VirtualDisplay instance from MediaProjection#createVirtualDisplay
virtualDisplay.resize(width, height, dpi);
// Create a new Surface with the updated size (depending on the application's use
// case, this may be through different APIs - see Surface documentation for
// options).
int texName; // the OpenGL texture object name
SurfaceTexture surfaceTexture = new SurfaceTexture(texName);
surfaceTexture.setDefaultBufferSize(width, height);
Surface surface = new Surface(surfaceTexture);
// Ensure the VirtualDisplay has the updated Surface to send the capture to.
virtualDisplay.setSurface(surface);
}
の Java ドキュメント android.media.projection.MediaProjection.Callback.onCapturedContentResize(int, int)
。
このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。