SandCastleIcon.png This article has links to websites or programs outside of Scratch and Wikipedia. Remember to stay safe while using the internet, as we cannot guarantee the safety of other websites.
The Phosphorus Player playing a project

Phosphorus is an alternative player used to run Scratch projects. It has the same aim as the Scratch HTML5 Player, but is still being actively developed. The player runs in JavaScript and uses the HTML5 canvas to display scratch projects. Due to its use of JavaScript, it is widely known to make projects that use heavy or intense calculations run much faster than in the widely used Flash Player.

Often more advanced users add a link in their project description leading directly to their project in phosphorus. This can be seen especially often in pen projects.

The Sulfurous Player is a modification of the Phosphorus Player, and was designed to perform better and deliver more features. Some long-standing bugs of the Phosphorus Player were also fixed. Phosphorus player has been succeeded by Forkphorus player which has reduced the number of bugs even more.[1]

Users are known to use Phosphorus to view other users' unshared projects and give their feedback on the projects.[2]

Usage

To view a project in Phosphorus, simply paste the URL of your project on the Scratch webpage in the input box. Your project should be loaded and will run automatically. Pasting the ID of your project will also suffice. Dragging a local .sb2 file into the page is also supported, allowing users to test their projects locally before potentially uploading or sharing them on the Scratch website.

If you want to include a link to your project in the player, simply include the Phosphorus URL appended with a hashtag and your project ID in your project notes, or wherever you want it. Such a URL could look like this: https://phosphorus.github.io/#000000000

Background Information

phosphorus was created by Nathan Dinsmore in collaboration with Truman Kilen. The phosphorus page credits state:

phosphorus was created by Nathan. Its CPS-style compilation and overall design was inspired by Rhys's sb2.js. It would have more bugs if not for Truman and Tim. It uses the JSZip library, created by Stuart Knightley, David Duponchel, Franz Buchinger, and António Afonso, to read .sb2 files and compressed projects, and the canvg library, created by Gabe Lerner, to render SVGs in <canvas> elements.

– phosphorus Credits[3]

phosphorus is an open source program, and the code can be found on GitHub. The phosphorus page also includes options for packaging and embedding projects on third party websites. The user can customize the appearance of the embedded project to some extent, such enabling or disabling controls.

Differences from the Scratch 2.0 Flash Player

  • There's an option to pause all of the scripts and then rerun it.
  • Projects usually run much faster in Phosphorus, especially Pen projects or those using heavy processing.
  • Projects will run on any device using a browser with HTML5 canvas support; this includes most mobile devices which don't have Flash support. However, keyboard commands cannot be used on most mobile devices.
  • phosphorus does not have the Flash Player's clone limit of 301 clones, thus it is possible to have infinite clones and cause some more lag.
  • Some small bugs where Phosphorus behaves differently to the Scratch Flash Player.

Detecting Phosphorus

Archive.png This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.

Since Phosphorus and the Flash Player differ slightly, a project can detect which player is running it.

The Flash Player treats boolean values as a subcategory of integers; that is, the boolean true value is equivalent to 1 in the Flash Player, and false is equivalent to 0 (though note that the strings "1" and "true" are not equal). Conversely, Phosphorus has no such equivalence: 1 and true (the boolean) are treated as two different objects.

The script below will cause its sprite to say which player is being run.

when gf clicked
if <[1] = <[1] = [1]>> then
say [You are in the Flash Player]
else
say [You are in phosphorus]
end

Another difference between Flash and Phosphorus is that Phosphorus will set its costume number to (1) if an invalid costume name or number is entered in the "switch to costume" block, whereas Flash does not do anything. The following script can be used to detect Phosphorus using this technique:

when flag clicked
switch costume to [costume 2 v]
switch costume to (join [hello][world])
if <(costume #) = [1]> then
  say [phosphorus]
else
  say [Flash]
end

Since only Phosphorus will switch the costume to costume 1, the script can detect what player you are using.

See Also

References

Cookies help us deliver our services. By using our services, you agree to our use of cookies.