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

Partial membership gift support #90

Merged
merged 8 commits into from
Jul 6, 2022
Merged

Partial membership gift support #90

merged 8 commits into from
Jul 6, 2022

Conversation

ChrRubin
Copy link
Member

@ChrRubin ChrRubin commented Jul 5, 2022

Adds partial support for membership gifts. Both "purchases" and "redemptions" are shown in the message area, and gift purchases are shown in the ticker bar. I'm not sure whether redeeming said gifts work for the user themselves, hence "partial" support until someone is lucky enough (or unlucky if it doesn't work via HyperChat) to find out.

I've also refactored the ticker chip UI to its own component since there was duplicate code. MembershipItem.svelte and PaidMessage.svelte are basically reverted back to pre #79 aside from adding gift support to MembershipItem.svelte.

Desc Image
Gift purchase image
Gift redemptions image
Ticker dialog image

@KentoNishi I need help with a bug on the ticker logic. Membership gift tickers from initial data for live streams don't come with a timestampUsecvalue (thanks YT), so they will appear for a second and then disappear on the next tick, even though there's still duration left for the ticker. I'm assuming this line doesn't like the NaN showtime value, but I can't figure out how to fix it:

onMount(() => {
interval = window.setInterval(() => {
$stickySuperchats = $stickySuperchats.filter(sc => {
return $currentProgress === null || (
(sc.showtime / 1000 - 5 <= $currentProgress) &&
(sc.showtime / 1000 + sc.tickerDuration) >= $currentProgress
);
});
}, 500);
});

@KentoNishi
Copy link
Member

so there's a way to opt into gifting via the membership join screen. i'll try to reverse-engineer this later so we can add "full" support

image

const timestampUsec = parseInt(renderer.timestampUsec);
const timestampText = renderer.timestampText?.simpleText;
const runs = parseMessageRuns(messageRenderer.message?.runs);
const timestampUsec = parseInt(renderer.timestampUsec || (Date.now() * 1000).toString());
Copy link
Member

Choose a reason for hiding this comment

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

@ChrRubin does this work? it's a bit cheap but basically if there's no timestampUsec i just made it generate one based on the time of parsing lmao

this should work if the issue you mentioned only happens for initial data load in live chats only, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Need to wait till a stream gets gifted before I can test this.

I don't know if it affects VODs, since that's even more of an edge case where someone has to gift memberships within ~10 seconds of the stream starting. We also are using videoOffsetTimeMsec instead of timestampUsec for VOD message showtimes, so maybe it isn't affected? Who knows with how YT does things...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup can confirm it's fixed for live streams

@KentoNishi
Copy link
Member

if that works, we should probably merge this before i spend my last 2 brain cells dissecting the enable gifting panel lolmao

@KentoNishi
Copy link
Member

image

@KentoNishi
Copy link
Member

use https://youtu.be/k_skfzMMyso?t=5452 if u need a video to test with

@r2dev2
Copy link
Member

r2dev2 commented Jul 6, 2022

use youtu.be/k_skfzMMyso?t=5452 if u need a video to test with

*clicks on vid
*gura talkin bout armpits

@KentoNishi
Copy link
Member

typical gura experience lmao i love watching vods while deving i can feel both big brain and degen at the same time

@KentoNishi KentoNishi merged commit 717f425 into master Jul 6, 2022
@KentoNishi KentoNishi deleted the member-gift branch July 6, 2022 17:39
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.

None yet

3 participants