Language

MediaProjection.Callback.OnCapturedContentResize(Int32, Int32) メソッド

定義

キャプチャが開始された直後、またはキャプチャされたリージョンのサイズが変更されたときに呼び出され、ストリーミング されたキャプチャの正確なサイズ設定が提供されます。

[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とは異なる場合、キャプチャされたストリームには、記録されたコンテンツの周囲にレターボックス (黒いバー) があります。 アプリケーションは、 VirtualDisplay と出力 Surfaceの両方のサイズを更新することで、記録されたコンテンツのレターボックス化を回避できます。

&#x40;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ドキュメント。

このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。

適用対象