Skip to content

Commit

Permalink
1.1.8: player.update()
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir-Alipour committed Oct 9, 2023
1 parent 491af72 commit d6982dd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ Event | param | Description | Example
`forward` | () | forward to 5s later | player.forward()
`backward` | () | backward to 5s before | player.backward()
`forceUpdatePlayer` | () | forece Re-Render player | player.forceUpdatePlayer()
`update` | () | update player | player.update()

</br>
</br>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reaplay",
"version": "1.1.7",
"version": "1.1.8",
"description": "the react HOC for create custom players with any styles you like",
"author": "amir-alipour",
"license": "MIT",
Expand Down
16 changes: 15 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ export const Reaplay = ({ tracks, startIndex = 0, children }: Props) => {
setForcePlayerUpdate((prev) => prev + 1)
}

const update = (): void => {
onScrubEnd();
}

/**
* manage isPlay state for play or pause the song
* start timer for detect when the song ended or more ..
Expand All @@ -403,6 +407,14 @@ export const Reaplay = ({ tracks, startIndex = 0, children }: Props) => {
}
}, [isPlaying])

/**
* manage isRepeat update state for repeat the song
*/

useEffect(() => {
onScrubEnd();
}, [isRepeat])

/**
* manage the buffered value of playing song
*/
Expand Down Expand Up @@ -525,7 +537,8 @@ export const Reaplay = ({ tracks, startIndex = 0, children }: Props) => {
playSlow, // play slow playbackRate of track
playNormal, // play normal playbackRate of track
playFast, // play fast playbackRate of track
forceUpdatePlayer // force Re-Render Player
forceUpdatePlayer, // force Re-Render Player
update // update the player
}

// @ts-ignore
Expand Down Expand Up @@ -574,4 +587,5 @@ export interface PlayerType {
forward: Function
backward: Function
forceUpdatePlayer: Function
update: Function
}

0 comments on commit d6982dd

Please sign in to comment.