Replies: 2 comments 8 replies
-
It might be easiest to use the forkphorus packager to generate an HTML file and use an <iframe> to embed that project in your page If that won't work, you can manually use the forkphorus player API (which is very poorly designed): <!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/path/to/forkphorus/phosphorus.css">
<style>
#player {
width: 480px;
height: 392px;
}
</style>
</head>
<body>
<div id="player"></div>
<script src="/path/to/forkphorus/lib/scratch-sb1-converter.js"></script> <!-- Needed for Scratch 1 projects -->
<script src="/path/to/forkphorus/lib/jszip.min.js"></script>
<script src="/path/to/forkphorus/lib/fontfaceobserver.standalone.js"></script>
<script src="/path/to/forkphorus/lib/canvg.min.js"></script> <!-- Needed for Scratch 2 projects-->
<script src="/path/to/forkphorus/lib/purify.min.js"></script>
<script src="/path/to/forkphorus/phosphorus.dist.js"></script>
<script>
P.io.config.localPath = '/path/to/forkphorus/'; // needs a / at the end
var playerElement = document.getElementById('player');
var player = new P.player.Player();
playerElement.appendChild(player.root);
player.addControls();
new P.player.ProgressBar(player);
var projectURL = "https://packager.turbowarp.org/example.sb3"; // URL to FULL sb, sb2, sb3
var projectType = "sb3"; // the file extension of the project
fetch(projectURL)
.then((r) => r.arrayBuffer())
.then((buffer) => player.loadProjectFromBuffer(buffer, projectType));
</script>
</body>
</html> |
Beta Was this translation helpful? Give feedback.
-
Yes, but the sb3 projects will be uploaded by people that don't know about technical stuff
I will certainly give it a try. Can I use a similar strategy for the TurboWarp player? (it could make sense, as I guess it is more compatible with Scratch 3 projects; NOTE: excellent speed is not a requirement) |
Beta Was this translation helpful? Give feedback.
-
Can I use Forkphorus to run a project that I uploaded to a personal website? I mean, after installing Forkphorus on the website. Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions