Embedding RemixWarp Projects
RemixWarp provides powerful embedding capabilities that allow you to integrate projects into websites, applications, and other platforms with enhanced features and customization options.
Basic Embedding
Simple iframe Embedding
The easiest way to embed a RemixWarp project:
<iframe
src="https://remixwarp.pages.dev/${projectId}/embed?${params}`;"
width="480"
height="360"
frameborder="0"
scrolling="no"
allowfullscreen>
</iframe>
Enhanced Embedding
Supported embed parameters include autoplay, addons, and standard runtime options like turbo, fps, hqpen, interpolate, and size:
<iframe
src="https://remixwarp.pages.dev/${projectId}/embed?${params}`;?autoplay&turbo&fps=60"
width="800"
height="600"
frameborder="0"
scrolling="no"
allowfullscreen>
</iframe>
Embedding Parameters
Basic Parameters
| Parameter | Values | Description |
|---|---|---|
autoplay | boolean | Auto-start project on load |
username | string | Set username used by blocks |
turbo | boolean | Enable turbo mode |
Display Parameters
| Parameter | Values | Description |
|---|---|---|
fps | number | Set frame rate |
hqpen | boolean | High quality pen rendering |
size | WIDTHxHEIGHT | Custom stage dimensions |
interpolate | boolean | Enable motion interpolation |
Embed-Specific Parameters
| Parameter | Values | Description |
|---|---|---|
addons | comma list | Enable specific addons (eg. pause,gamepad) |
settings-button | boolean | Show settings button in player header |
fullscreen-background | CSS color | Fullscreen background color override |
Advanced Embedding
Responsive Embedding
Create responsive embeds that adapt to container size:
<div style="position: relative; padding-bottom: 75%; height: 0;">
<iframe
src="https://remixwarp.pages.dev/${projectId}/embed?${params}`;"
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
frameborder="0"
allowfullscreen>
</iframe>
</div>
Custom Theming
Theme and accent are not controlled by URL parameters in embeds. Use CSS around the iframe or the Packager for theme control.
JavaScript API Integration
PostMessage Communication
Embeds accept LOAD_SB3 messages for loading projects. See detailed guide: /user-guide/embed-messaging.
// Send SB3 to the embed (URL or binary)
const iframe = document.getElementById('RemixWarp-embed');
iframe.contentWindow.postMessage({
type: 'LOAD_SB3',
data: 'https://remixwarp.pages.dev/${projectId}/embed?${params}`;',
title: 'Optional Title'
}, '*');
// Receive load response
window.addEventListener('message', (event) => {
if (event.data && event.data.type === 'LOAD_SB3_RESPONSE') {
console.log(event.data.status, event.data.message);
}
});
Event Handling
Embeds do not emit general project events via postMessage. Use the VM API within the embed context if you need state.
Packager Integration
Standalone Embeds
Use the RemixWarp Packager for standalone embeds:
- Visit packager.02engine.org
- Enter your project URL or upload project file
- Configure embedding options
- Download generated HTML file
Self-Hosted Embeds
Host projects on your own server:
<!-- Self-hosted project -->
<iframe
src="/path/to/your/project.html"
width="480"
height="360">
</iframe>
Embedding Best Practices
Performance Optimization
Lazy Loading
Load embeds only when needed:
// Intersection Observer for lazy loading
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const iframe = entry.target;
iframe.src = iframe.dataset.src;
observer.unobserve(iframe);
}
});
});
document.querySelectorAll('iframe[data-src]').forEach(iframe => {
observer.observe(iframe);
});
Preloading
Preload critical resources:
<link rel="preload" href="https://remixwarp.pages.dev/${projectId}/embed?${params}`;" as="script">
<link rel="preload" href="https://remixwarp.pages.dev/${projectId}/embed?${params}`;" as="script">