Skip to content

Commit

Permalink
fix(react): null source
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiya committed Oct 18, 2024
1 parent 360f4fb commit 365a06f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oplayer/react",
"version": "1.2.11-beta.0",
"version": "1.2.11-beta.1",
"description": "React wrapper for oplayer.",
"type": "module",
"main": "./dist/index.es.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const ReactOPlayer = forwardRef((props: ReactOPlayerProps, ref: Ref<Player | nul
const onRefChange = useCallback((node: HTMLDivElement) => {
if (node !== null && !isReady) {
player.current = Player.make(node, rest).use(plugins).create()
if (source instanceof Promise || (source as Source).src) player.current.changeSource(source!)
if (source instanceof Promise || (source as Source)?.src) player.current.changeSource(source!)
if (typeof duration == 'number') player.current.seek(duration / 1000)
if (onEvent) {
player.current.on((payload: PlayerEvent) => onEventRef.current?.(payload))
Expand Down

0 comments on commit 365a06f

Please sign in to comment.