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

Control size (height x width) of video playback. #47

Open
vincenzon opened this issue Jan 7, 2019 · 8 comments · May be fixed by #48
Open

Control size (height x width) of video playback. #47

vincenzon opened this issue Jan 7, 2019 · 8 comments · May be fixed by #48
Labels

Comments

@vincenzon
Copy link

When I playback a video, it is very large and I have to scroll around to see all of it. Is it possible to control the size of the video using the widget? I tried setting height and width in the layout but that just changed the size of the window one could watch the video through (I hope that makes sense) not the size of the underlying video.

@martinRenou
Copy link
Collaborator

If you are using a VideoStream, my_video_stream.video.width = 50 should work. If it doesn't, then it's a bug, the stream should have the same size as the underlying video widget.

If you are using a VideoRecorder, my_video_recorder.video.width = 50 should work. And when you display the recorded video, it should have the size you specified.

@vincenzon
Copy link
Author

I did this:

video_stream = VideoStream.from_url(video_file)
video_stream.video.width = 100
video_stream.video.height = 100
video_stream

and it still plays very large. Is that the syntax that should work?

@vincenzon
Copy link
Author

vincenzon commented Jan 7, 2019

This way of playing the video respects the height and width setting:

video_stream = VideoStream.from_url(video_file)
video_stream.video.width = 100
video_stream.video.height = 100
video_stream.video

I'm not sure what the difference is in the invocations.

@martinRenou martinRenou added the bug label Jan 8, 2019
@martinRenou
Copy link
Collaborator

video_stream.video is a Video widget while video_stream is a VideoStream widget. You can see video_stream.video as the input video for the VideoStream widget.

The main difference between Video and VideoStream widgets is that if you display a Video widget multiple times, the views won't be synchronized, while if you do that with a VideoStream widget they will be synchronized. The fact that they are synchronized is crucial for making it possible to record images, sound or videos using the ImageRecorder, the AudioRecorder or the VideoRecorder.

What you found is a bug. The size of the VideoStream widget should be the same as the Video widget.

@maartenbreddels
Copy link
Owner

I thought this would work:

video_stream.layout.width = '50px'

But it does not, it will add the css to the div, but the child video element doesn't care about it. I'm not sure what the best strategy would be for VideoStream (and Video).

@martinRenou
Copy link
Collaborator

Video already has width and height attributes. I guess we "just" need to add width and height attributes to VideoStream and link them to those from the underlying Video widget. Then on the Javascript size, we need to set the attributes of the video element, as we do for the Video widget.

@maartenbreddels
Copy link
Owner

But it seems you cannot use flexbox, and i'm not sure why.

@martinRenou
Copy link
Collaborator

martinRenou commented Jan 8, 2019

Why do you want to use flexbox? I don't think it's a CSS issue, there is no CSS to add in my opinion. We just need to set the width and height attributes of the video DOM element in the VideoStream widget.

@martinRenou martinRenou linked a pull request Jan 9, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants