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 #673

Merged
merged 4 commits into from
Aug 23, 2024
Merged

TS SDK #673

merged 4 commits into from
Aug 23, 2024

Conversation

wkozyra95
Copy link
Member

@wkozyra95 wkozyra95 commented Aug 19, 2024

Packages

  • live-compositor - main package user interacts, minimal dependencies, this package would be the only that third party libs should depend
  • @live-compositor/node - Implements node specific stuff, used to create instance of the compositor, there will be react and react-native variants in the future
  • @live-compositor/core - Implements platform independent part that will be used by packages like @live-compositor/node or react/react-native
  • examples
    • simple - basic View + Text example with some state updates.
    • dynamic-text - Component that shows text adding letter by letter (and removing it back in the loop)
    • news-ticker - Component that implements moving bar of text that loops on itself (video below)
recording_0819_1432.mp4

@wkozyra95 wkozyra95 linked an issue Aug 19, 2024 that may be closed by this pull request
20 tasks
@wkozyra95 wkozyra95 force-pushed the @wkozyra95/ts-sdk branch 11 times, most recently from 7f5a6c0 to 0d570a5 Compare August 21, 2024 10:16
@wkozyra95 wkozyra95 marked this pull request as ready for review August 21, 2024 11:11
@wkozyra95 wkozyra95 changed the title [WIP] TS SDK TS SDK Aug 21, 2024
TilesProps,
};

export { ShaderParam, ShaderParamStructField, EasingFunction, Transition };
Copy link
Member Author

@wkozyra95 wkozyra95 Aug 23, 2024

Choose a reason for hiding this comment

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

I'm not sure about that, the problem here is that types are partially defined in API and partially overridden here. Technically those types will not be imported in user code, but it still more messy than what I would prefer


## Documentation

Components props are documented via TypeScript types definitions in this package. You can also refer to LiveCompositor (e.g. [View](https://compositor.live/docs/api/components/View)), but keep in mind to convert field names from snake case to camel case.
Copy link
Member Author

Choose a reason for hiding this comment

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

I plan to add separate docs for typescript, but I did not think it through yet how it will work

/**
* (**default=`"#00000000"`**) Background color in a `"#RRGGBBAA"` format.
*/
backgroundColorRgba?: Api.RGBAColor;
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm considering renaming that to backgroundColor and supporting more formats than the LiveCompositor server does.

/**
* Path to the MP4 file.
*/
path?: string | null;
Copy link
Member Author

Choose a reason for hiding this comment

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

maybe serverPath to avoid confusion if the node is deployed in a different location than the compositor.

Comment on lines +3 to +12
export function intoRegisterOutput(
output: RegisterOutput,
initialVideo?: Api.Video
): Api.RegisterOutput {
if (output.type === 'rtp_stream') {
return intoRegisterRtpOutput(output, initialVideo);
} else {
throw new Error(`Unknown input type ${(output as any).type}`);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Add mp4 output

ts/@live-compositor/core/src/output.ts Show resolved Hide resolved
@wkozyra95 wkozyra95 merged commit 9363f96 into master Aug 23, 2024
3 checks passed
@wkozyra95 wkozyra95 deleted the @wkozyra95/ts-sdk branch August 23, 2024 11:33
@wkozyra95 wkozyra95 self-assigned this Aug 23, 2024
/**
* Id of a component.
*/
id?: Api.ComponentId | null;
Copy link
Member

Choose a reason for hiding this comment

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

Is | null necessary if the field is marked with ?

Copy link
Member Author

Choose a reason for hiding this comment

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

? means no value or undefined, null is not allowed there if it's just ?, but on the other hand in other places I was removing that | null (generation from json schema is producing that)

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.

Typescript SDK
3 participants