Skip to content

Conversation

@kaseyvee
Copy link
Collaborator

@kaseyvee kaseyvee commented Apr 10, 2024

Changes

  • create video component
  • refactor controls to work with video

Screenshots/Videos

Designs

Desktop

Screenshot 2024-04-11 at 10 43 58 AM Screenshot 2024-04-11 at 10 44 08 AM

Mobile

Screenshot 2024-04-11 at 10 44 23 AM Screenshot 2024-04-11 at 10 44 48 AM Screenshot 2024-04-11 at 10 44 54 AM Screenshot 2024-04-11 at 10 45 02 AM

Storybook

Screenshot 2024-04-11 at 10 55 39 AM Screenshot 2024-04-11 at 10 55 19 AM

Light mode

Default
Screenshot 2024-04-15 at 11 14 37 AM

With captions
Screenshot 2024-04-15 at 11 15 15 AM

With poster
Screenshot 2024-04-15 at 11 15 29 AM

Error
Screenshot 2024-04-11 at 10 55 54 AM

Mobile
light-mobile

Dark mode

Default
Screenshot 2024-04-15 at 11 12 44 AM

Mobile
dark-mobile

Videos

Desktop Fullscreen
https://github.com/rustic-ai/ui-components/assets/111031789/e0ad61a1-f119-4c3e-adb9-068c3fe5f0f7

Desktop Picture-in-picture
https://github.com/rustic-ai/ui-components/assets/111031789/2f22fe6d-90b7-4c4e-b7e4-a2109d7f5c26

Mobile Fullscreen
https://github.com/rustic-ai/ui-components/assets/111031789/36a9f7fd-4652-4d72-be52-a6e4e32f56b8

Copy link
Contributor

@Shiti Shiti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking we should split the controls file into 3 - mediaIcons component, common(controls common to audio and video) and videocontrols. what do you think ?

| 'pictureInPicture'
| 'pictureInPictureExit'
| 'fullscreen'
| 'fullscreenExit'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to add the captions ones here too

| 'fullscreen'
| 'fullscreenExit'
className?: string
color?: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to pass the color as prop? can we not set it to 'primary' always ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The colours change based on the component as well as the viewport, so I was trying to think of a way to control this.

Copy link
Contributor

@Shiti Shiti Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the colors should not change by viewport. Please set this to primary

Copy link
Contributor

@Shiti Shiti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the commit message to clearly indicate what is being changed. Also, for tests, I would recommend using a local video file as that would help speed things up

@lyjeileen
Copy link
Collaborator

Could you hide the control bar when the mouse has not moved for a few seconds?

transcript?: string
}

export interface AudioFormat extends MediaFormat {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Is it necessary to add AudioFormat when it's exactly same as MediaFormat? Do we want to introduce a new type just for the semantic reason?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semantics for clarity but I'm also thinking in the future there could possibly be audio-only fields.

@kaseyvee
Copy link
Collaborator Author

I'm thinking we should split the controls file into 3 - mediaIcons component, common(controls common to audio and video) and videocontrols. what do you think ?

@Shiti This would make it easier to maintain. Will still have to think about how the controls in the settings menu will work.

const Icon = props.isTranscriptShown
? KeyboardArrowUpIcon
: KeyboardArrowDownIcon
export function CaptionsToggle(props: Toggle) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export function CaptionsToggle(props: Toggle) {
export function ToggleCaptionsButton(props: Toggle) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need to create a component for these 2 lines. Its not adding any value

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured since we're using it in both the Sound and Video components for now until the Video settings menu design flow was finalized, since it seems like playback rate, captions, etc will later be handled there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, in other cases, where you have defined a component for button, there is additional logic, whereas here there is none.

const Icon = props.isTranscriptShown
? KeyboardArrowUpIcon
: KeyboardArrowDownIcon
export function CaptionsToggle(props: Toggle) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need to create a component for these 2 lines. Its not adding any value

@kaseyvee kaseyvee marked this pull request as ready for review April 11, 2024 18:23
@kaseyvee kaseyvee force-pushed the dev branch 2 times, most recently from b1897f5 to bb98c0f Compare April 11, 2024 21:52
@Laurendragonscale
Copy link

Laurendragonscale commented Apr 11, 2024

We should consider adding a lot more contrast behind the video controls. Maybe even a solid colour like this:

Screenshot 2024-04-11 at 2 57 37 PM

@kaseyvee kaseyvee requested review from Shiti and lyjeileen April 11, 2024 23:23
@lyjeileen
Copy link
Collaborator

Hi! I found a bug in the mobile version. Here are the steps to reproduce it:

  • Click play button (It switched to the full screen mode)
  • Click the full screen toggle (It switched back to the small screen)
  • Click play button again => Nothing happened
  • Click play button again (It switched to the full screen mode)

@lyjeileen
Copy link
Collaborator

Should the video folder be in the media folder?

@kaseyvee
Copy link
Collaborator Author

kaseyvee commented Apr 12, 2024

Hi! I found a bug in the mobile version. Here are the steps to reproduce it:

  • Click play button (It switched to the full screen mode)
  • Click the full screen toggle (It switched back to the small screen)
  • Click play button again => Nothing happened
  • Click play button again (It switched to the full screen mode)

@lyjeileen Addressed. Initially spoke with @RenataDzotova about making this immediately go to fullscreen on mobile since it's not obvious you have to go to fullscreen for the controls. Maybe we can address this in the future, so I've updated to be back to the original design. Clicking play now simply plays the video without going fullscreen and added back the fullscreen button.

@Shiti
Copy link
Contributor

Shiti commented Apr 12, 2024

@kaseyvee when transcript is shown in full screen mode, the other controls are not visible even on hover. We have to hide transcript for any other controls to be visible.

@Shiti
Copy link
Contributor

Shiti commented Apr 12, 2024

When showing picture-in-picture, I think it should show the poster /first frame at the original location.

)
}

function renderCaptionsToggle() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function renderCaptionsToggle() {
function renderCaptionsButton() {


export function PausePlayToggle(props: MediaControls) {
const [isPlaying, setIsPlaying] = useState(false)
export function PlayOrPauseToggle(props: MediaControls) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export function PlayOrPauseToggle(props: MediaControls) {
export function PlayOrPauseButton(props: MediaControls) {

element: HTMLElement
}

export function PictureInPictureToggle(props: MediaControls) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export function PictureInPictureToggle(props: MediaControls) {
export function PictureInPictureButton(props: MediaControls) {

Comment on lines 21 to 50
function handlePictureInPicture() {
if (isPictureInPicture) {
document.exitPictureInPicture()
} else {
videoElement.requestPictureInPicture()
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both document.exitPictureInPicture() and videoElement.requestPictureInPicture() return Promise. Use that instead of adding event handlers below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left the onleavepictureinpicture handler for when users exit from the pip window.

Comment on lines 47 to 84
document.exitFullscreen()
} else {
props.element.requestFullscreen()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update this to handle the returned Promise.

@kaseyvee
Copy link
Collaborator Author

@kaseyvee when transcript is shown in full screen mode, the other controls are not visible even on hover. We have to hide transcript for any other controls to be visible.

@Shiti Not quite sure how the designs are meant to handle showing the transcript on fullscreen with the controls. I could make them appear like this with a max height of 25% viewport height:
Screenshot 2024-04-12 at 1 13 55 PM

@Laurendragonscale @RenataDzotova @lyjeileen What do you guys think?

@Shiti
Copy link
Contributor

Shiti commented Apr 12, 2024

on desktop, the transcript comes below the controls so I would assume that the same happens on mobile as well.

@kaseyvee kaseyvee requested a review from Shiti April 13, 2024 17:19
@kaseyvee kaseyvee requested a review from Shiti April 15, 2024 15:17
props.mediaElement.play()
setIsPlaying(true)
props.mediaElement.play().catch(() => {
props.onError('Failed to play the media. Please try again.')
Copy link
Contributor

@Shiti Shiti Apr 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are catching the exception but not capturing any information regarding it.

Possible errors include:

In these scenarios, trying again will be of no use. The appropriate message should be indicated clearly so user understands what the issue is and why the media cannot be played.

Reference - https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play

@Shiti Shiti merged commit 1fbda4b into rustic-ai:main Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants