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

[ts-sdk] Make react sdk run on browser #776

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

noituri
Copy link
Member

@noituri noituri commented Sep 18, 2024

This PR adds bare minimum to make the wasm compositor work with our react sdk. It implements simple queue, mp4 input and canvas output. Not everything is fully implemented (i.e. Input state notifications) but I want to get the feedback early before proceeding further.

@noituri noituri force-pushed the @noituri/wasm-react-instance branch 9 times, most recently from d0b04a1 to 02c0d0a Compare September 25, 2024 15:20
@noituri noituri marked this pull request as ready for review September 25, 2024 15:31
ts/@live-compositor/web/src/compositor.ts Outdated Show resolved Hide resolved
ts/@live-compositor/web/src/fifo.ts Outdated Show resolved Hide resolved
ts/@live-compositor/web/src/input/input.ts Show resolved Hide resolved
ts/examples/vite-browser-render/src/examples/MP4Player.tsx Outdated Show resolved Hide resolved
ts/@live-compositor/web/src/compositor.ts Outdated Show resolved Hide resolved
ts/@live-compositor/web/src/input/mp4/source.ts Outdated Show resolved Hide resolved
@@ -2,7 +2,8 @@ import * as Api from '../api';

export type RegisterInput =
| ({ type: 'rtp_stream' } & RegisterRtpInput)
| ({ type: 'mp4' } & RegisterMp4Input);
| ({ type: 'mp4' } & RegisterMp4Input)
| { type: 'bytes' };
Copy link
Member

Choose a reason for hiding this comment

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

bytes is not a valid type, I assume this will be raw frames? in that case frames or raw_frames, frame_bytes

What about audio? Is this video only input?

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently, it's only video input

ts/@live-compositor/web/src/compositor.ts Outdated Show resolved Hide resolved
ts/@live-compositor/web/src/manager/wasmInstance.ts Outdated Show resolved Hide resolved
ts/examples/vite-browser-render/src/App.tsx Outdated Show resolved Hide resolved
@noituri noituri force-pushed the @noituri/wasm-react-instance branch 2 times, most recently from 295d574 to f6471eb Compare October 1, 2024 10:53
@noituri noituri requested a review from wkozyra95 October 1, 2024 10:59
@noituri noituri force-pushed the @noituri/wasm-react-instance branch from f6471eb to f136ee8 Compare October 1, 2024 15:48
@noituri noituri force-pushed the @noituri/wasm-react-instance branch from f136ee8 to 84100bb Compare October 3, 2024 13:08
@noituri noituri force-pushed the @noituri/wasm-react-instance branch from 84100bb to bc13cb0 Compare October 3, 2024 13:41
const inputs = useInputStreams();
const inputState = inputs['bunny_video']?.videoState;

if (!inputState || inputState == 'ready') {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (!inputState || inputState == 'ready') {
if (inputState !== 'playing') {

}

public async registerInput(inputId: string, request: RegisterInput): Promise<void> {
await this.coreCompositor!.registerInput(inputId, intoRegisterInput(request));
Copy link
Member

@wkozyra95 wkozyra95 Oct 7, 2024

Choose a reason for hiding this comment

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

registerInput needs to handle internally initializing mp4(in the sendRequest implementation), otherwise hook with a new stream will trigger to early

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