Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option or method to set Picture-in-PictureWindow to maximum size programmatically #163

Open
guest271314 opened this issue Aug 16, 2019 · 6 comments

Comments

@guest271314
Copy link

commented Aug 16, 2019

Located this issue from

The title of the linked Chrome issue https://bugs.chromium.org/p/chromium/issues/detail?id=949570 does not contain the language of this feature request. To avoid confusion, filing this issue for clarity.

Note, it is not immediately obvious that the PictureInPicture window can be resized by user action.

It is apparently also not specified or possible by means of a workaround that have yet succeeded to resize PictureInPicture window programmatically. Persisting a user-resized Picture-in-Picture window requires running the code twice to begin recording at the maximum width or await pictureInPicture.width === screen.width/2 within resize event, then proceed, which is not necessarily possible for each attempt due to the implementation of the resized window, where the output should be met at the first attempt, without awaiting executing requestPictureInPicture() twice or width and height values at resize event initiated by user action.

(Though beyond the scope of this specific issue it should also be possible to resize Picture-in-Picture to fullscreen)

The use case for setting width and height of Picture-in-Picture programmatically, without user action, is recording PictureInPicture window, to utilize the unique playback capabilities of the Picture-in-Picture window.

@guest271314

This comment has been minimized.

Copy link
Author

commented Aug 17, 2019

Example of the use case https://github.com/guest271314/MediaFragmentRecorder/edit/getdisplaymedia-pictureinpicture/MediaFragmentRecorder.html where it is not currently possible to resize PictureInPictureWindow programmatically, for example, using resizeTo() to match videoWidth and videoHeight of HTML pictureInPictureElement for the expected output of using getDisplayMedia() as a workaround for MediaRecorder stopping per specification when HTML <video> element src is changed.

@beaufortfrancois

This comment has been minimized.

Copy link
Collaborator

commented Aug 19, 2019

You can resize Picture-in-Picture window by adjusting video width and height. Give it a try at https://beaufortfrancois.github.io/sandbox/media/picture-in-picture-canvas

@guest271314

This comment has been minimized.

Copy link
Author

commented Aug 19, 2019

Does the capability exist to resize Picture-in-Picture widnow exceeding screen.width/2 to match the videoWidth and videoHeight of the source media? If not, why?

@guest271314

This comment has been minimized.

Copy link
Author

commented Aug 19, 2019

Why does the PictureInPictureWindow not match the exact width and height set?

@guest271314

This comment has been minimized.

Copy link
Author

commented Aug 19, 2019

At the linked document when input is 400x300 output is 478x359.

The expected result is when input video has pixel dimensions 1280x720 PictureInPictureWindow should be capable of rendering those exact dimensions. If the src of the <video> changes and the videoWidth and videoHeight are 768x576, it should be possible to set those properties directly programmatically.

@guest271314

This comment has been minimized.

Copy link
Author

commented Aug 19, 2019

@beaufortfrancois Must have not updated the branch at the above link at #163 (comment). Updated now with Picture-in-Picture code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.