Skip to content

Commit

Permalink
feat: Ruffle embed fullscreen button
Browse files Browse the repository at this point in the history
  • Loading branch information
colin969 committed Oct 14, 2023
1 parent a1470ac commit af27e3a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions extensions/core-ruffle/static/templates/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@ body {
text-align: center;
margin-top: 1rem;
margin-bottom: 1rem;
}
.button-row {
margin-top: 1rem;
display: flex;
flex-direction: row;
justify-content: left;
}
7 changes: 7 additions & 0 deletions extensions/core-ruffle/static/templates/basic.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,25 @@
<div class="page-content">
<div class="game-title">{{title}}</div>
<div id="embed-container"></div>
<div class="button-row">
<button class="button-basic" onclick="(() => {
window.player.enterFullscreen();
})()">Fullscreen</button>
</div>

<script>
window.RufflePlayer = window.RufflePlayer || {};
window.RufflePlayer.config = {
"allowScriptAccess": true,
"autoplay": "on",
}
window.addEventListener("load", (event) => {
const ruffle = window.RufflePlayer.newest();
const player = ruffle.createPlayer();
const container = document.getElementById("embed-container");
container.appendChild(player);
player.load("{{{sourceUrl}}}");
window.player = player;
});
</script>
<script src="http://ruffle.rs/ruffle.js"></script>
Expand Down

0 comments on commit af27e3a

Please sign in to comment.