Skip to content

Conversation

elalish
Copy link
Contributor

@elalish elalish commented Aug 24, 2021

I removed the semi-functional poster UX in the editor and now the poster is auto-generated on any save and whenever it is deployed to mobile. In fact posters were not working on mobile at all before, but now they do, and they improve the experience since they demonstrate the use while the slow piping server downloads. I'm also generating only WebP images, since they are supported universally now (since IE is dead) and they have compact lossy compression with an alpha channel.

@elalish elalish requested review from samaneh-kazemi, a user and chrismgeorge August 24, 2021 18:34
@elalish elalish self-assigned this Aug 24, 2021
++this.scaleStep;
} else if (
this.avgFrameDuration < LOW_FRAME_DURATION_MS && this.scaleStep > 0) {
--this.scaleStep;
}
this.scaleStep = Math.min(this.scaleStep, this.lastStep);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This ensures minScale will be respected immediately on the next render.

@@ -469,6 +469,8 @@ export const LoadingMixin = <T extends Constructor<ModelViewerElementBase>>(
this.dispatchEvent(new CustomEvent('poster-dismissed'));
});
}, {once: true});
} else {
this[$transitioned] = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Found a small bug where when things changed too quickly, the transitioned event would not fire and then the state would get messed up. This ensures the state is correct for the poster to dismiss.

@@ -180,6 +182,10 @@ export class OpenMobileView extends ConnectedLitElement {

await post(JSON.stringify(packet), getSessionUrl(this.pipeId, session.id));

await post(
posterBlob,
posterToSession(this.pipeId, session.id, updatedContent.posterId));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This post is what allows the poster to function on mobile (it was set to an objectURL before, but that can't be accessed from a different device; it must be explicitly sent over the network).

}

const SET_MIMETYPE = 'SET_MIMETYPE';
export function dispatchMimeType(type: ImageType) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put this in because I thought I'd allow choosing PNG, JPEG, WEBP, but then I realized WEBP is definitely the best, so I removed the UX. I left the logic in case it's useful down the road.

@elalish elalish merged commit 490643a into master Aug 24, 2021
@elalish elalish deleted the autoPosterGeneration branch August 24, 2021 19:03
// Set to beginning of animation
const oldTime = modelViewer.currentTime;
modelViewer.autoplay = false;
modelViewer.currentTime = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

would it make sense to have reset or init function for this part?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe, but since the reset is pretty specific to the poster generation I feel like it's simpler to contain the logic here. If it comes in hand anywhere else, I'll definitely put it in a function.

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