Skip to content

Commit

Permalink
refactor: Update Video component and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
RSamaium committed Jan 6, 2025
1 parent ad183f5 commit a7d9d93
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ Features:
- Particle Emitter
- Audio System

## Note: Performance Comparison with Pixi React

CanvasEngine offers significant performance advantages over Pixi React. While Pixi React relies on React's detection cycles in addition to Pixi's traversal, which can be resource-intensive, CanvasEngine takes a more granular approach. It only updates the specific elements that have changed, resulting in more efficient rendering and better overall performance.

## Installation

```bash
Expand Down
4 changes: 4 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ const guideMenu = [
text: "TilingSprite",
link: "/components/tilling-sprite",
},
{
text: "Video",
link: "/components/video",
},
],
},
{
Expand Down
25 changes: 25 additions & 0 deletions docs/components/video.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use Video component

```html
<Video src="myvideo.mp4" play={true} />
```

## Props

- `src`: string
- `paused`: boolean
- `loop`: boolean
- `muted`: boolean

- `loader`: {
- `onComplete`: (texture: Texture) => void;
- `onProgress`: (progress: number) => void;
}


## Events

- `play`: () => void;
- `pause`: () => void;
- `ended`: () => void;
- `progress`: (progress: number) => void;
4 changes: 2 additions & 2 deletions packages/core/src/components/Video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Sprite } from "./Sprite";
import { effect, Signal, signal } from "@signe/reactive";

interface VideoProps {
source: string;
src: string;
paused?: boolean;
loop?: boolean;
muted?: boolean;
Expand Down Expand Up @@ -87,7 +87,7 @@ export function Video(props: VideoProps) {

return h(Sprite, {
...props,
image: props.source,
image: props.src,
loader: {
onComplete: (texture) => {
const source = texture.source.resource
Expand Down

0 comments on commit a7d9d93

Please sign in to comment.