FlashPulse Yes, you can do that in Flarum.
Since Ruffle is already loaded on your website, the cleanest way is to create a small custom Flarum extension that adds a BBCode such as:
[swf]https://example.com/files/game.swf[/swf]
Then the BBCode can be converted into an <embed> element that Ruffle detects automatically.
For example, in extend.php:
<?php
use Flarum\Extend;
use s9e\TextFormatter\Configurator;
return [
(new Extend\Formatter)
->configure(function (Configurator $config) {
$config->BBCodes->addCustom(
'[SWF]{URL}[/SWF]',
'<div class="swf-player">
<embed
src="{URL}"
type="application/x-shockwave-flash"
width="100%"
height="100%"
/>
</div>'
);
}),
];
Then you could post:
[swf]https://example.com/uploads/game.swf[/swf]
Ruffle should detect the Flash embed and replace it with the Ruffle player.
You can also add some CSS to make it responsive:
.swf-player {
width: 100%;
max-width: 900px;
aspect-ratio: 4 / 3;
margin: 15px auto;
}
.swf-player embed,
.swf-player ruffle-player {
width: 100%;
height: 100%;
}
I would recommend using a BBCode like this instead of allowing users to post raw <embed>, <object>, or JavaScript code. It is safer and gives you more control over what can be embedded.
If you also want users to upload .swf files directly from the Flarum composer, that would require an additional upload handler. The uploaded file URL could then automatically be inserted as:
[swf]URL-OF-UPLOADED-FILE.swf[/swf]
So yes, a custom [swf] embed code is definitely possible, and a small Flarum extension is probably the cleanest way to implement it.