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

feat: add currentTime and duration to playerStore #5

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

izkizk8
Copy link
Contributor

@izkizk8 izkizk8 commented Apr 10, 2024

This pull request primarily focuses on improving the video playback functionality in the application. The changes involve the addition of a currentTime and duration state to the player store, the creation of a utility function to format seconds into a time string, and the utilization of these new features in the BottomPanel.vue and CanvasPlayer.vue components.

Additions to player store state:

  • src/stores/player.ts: Added currentTime and duration as reactive state variables in the player store. These variables will keep track of the current playback time and total duration of the video, respectively.

Utility function creation:

  • src/utils/index.ts: Created a formatSeconds function that takes a number of seconds and formats it into a time string in the format of hours, minutes, and seconds. This function will be used to display the current time and duration in the player.

Updates to Vue components:

  • src/components/bottom-panel/BottomPanel.vue: Imported the formatSeconds function and added currentTime and duration to the list of variables obtained from the player store. Updated the time display in the bottom panel to use these new variables. [1] [2]
  • src/components/player/CanvasPlayer.vue: Similar to BottomPanel.vue, added currentTime and duration to the list of variables obtained from the player store. Also added event listeners to the video element to update currentTime and duration accordingly as the video plays. [1] [2]

Test:
Animation

Copy link
Owner

@wangrongding wangrongding left a comment

Choose a reason for hiding this comment

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

🌸 Very well, thanks for your continued contribution to the project.

@wangrongding wangrongding merged commit 7f71007 into wangrongding:main Apr 10, 2024
1 check passed
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.

2 participants