6 ms·
Shumway: a SWF interpreter entirely in JavaScript
- ChuckMcM 14y agoPretty nice. The madness of interpreters on top of interpreters is not lost on my but still fun.
- deleted 14y ago[deleted]
- syg 14y agoTo be more precise, JITs on top of JITs. :) We have both an interpreter for ActionScript bytecode as well as a compiler that compiles that bytecode method-at-a-time to JavaScript using a restructuring approach like emscripten's relooper. Disclaimer: I work on Shumway.
- ChuckMcM 14y agoI could give you the old guy's rant, "Back in my day we were happy to have only one 'core' and if it ran at 8Mhz it was in turbo mode!" :-) Its an amazing piece of work.
- pjscott 14y agoBah! Back in my day, we counted ourselves lucky if we had an 8 MHz crystal clock. I had to make do with an uncomfortably temperature-dependent RC oscillator running at what I lightheartedly hoped was about 4 MHz. (I'm actually pretty young, but I've done work with microcontrollers, which feels like stepping into the past. I know a guy in his late 20s who steadfastly refuses to switch from assembly to C, for reasons that come straight out of the 70s. It's a strange world we live in.)
- deleted 14y ago[deleted]
- mcpherrinm 14y agoThis is pretty exciting. Flash player has never been my favourite piece of software, so having a reasonable alternative would be fantastic. I know there's also Gnash, but I haven't tried it in a long time, and I'm led to believe it is far from feature complete. Hopefully this project can push further.
- emmelaich 14y agoIf you're interested in Gnash you might be interested in http://en.wikipedia.org/wiki/Lightspark http://en.wikipedia.org/wiki/Lightspark "Lightspark is a free and open source SWF player" Still in beta.
- richforrester 14y agoBeing more of a designer than a developer, I've got to admit that the thought of second wind for Flash kind of scares me. I've never liked Flash, mainly because historically it wasn't as "open" as HTML, Macromedia Flash (I know, right) crashed a lot, as well as the general abuse of Flash found all around the web in the late 90's/early 2k. Anyone willing/able to take my (probably irrational) fear away and tell me why this SWF interpreter is a good thing?
- ludicast 14y agoEven though I think this is a cool project, I agree 100% with your fears. I used to do Flash/Flex/Air extensively, and often preached it to my fellow developers, despite considerable resistance. I argued that SWF was fulfilling the cross-platform promise of applets. And when Adobe managed to mishandle Macromedia's legacy, I was left with much egg on the face. I don't want to go through that again. That said, good for Mozilla. They really are running with a ton of impressive open source projects.
- BrendanEich 14y agoNo second wind here. Think instead of pdf.js and how it relieves you of the bloated security hole called Reader. PDF is a large format (extensions include SWF!) but pdf.js need not handle all of it to be useful in minimizing Reader activations. Similarly, Flash is going down, never to come back (thanks, SJ). So Shumway need handle only the tall head, possibly as a previewer if not a full Flash replacement. The long tail is not too fat, but it will require a plugin for the foreseeable future. In the far future, archeologists will pore over archive contents at the edge of the Beyond, decoding ancient languages including JS and SWF, leery of evil transcendant malware ;-). /be
- ludicast 14y agoVery well explained, you seem to know a lot about Javascript.
- 14y ago
- woogley 14y agoInteresting to see tobeytailor (of Gordon[1]) working on this. Is this built on the same code Gordon uses? [1]: https://github.com/tobeytailor/gordon/ https://github.com/tobeytailor/gordon/
- jpwagner 14y agoI don't know, but I would guess it is, if only because "Gordon Shumway" is the alias of ALF from the 80s tv show.
- thristian 14y agoI have good hopes for this (Mozilla's HTML5-based PDF reader is my favourite PDF browser plugin), but I'm a little worried - there have been a lot of Open Source Flash reimplementations, and so far as I can tell they all have early success and pretty demos of older Flash content, but are completely useless on most real-world Flash usage, like nearly any site that shows a video. I'll note that Gnash does actually work on YouTube.com, but only because YouTube seems to deliberately serve an ancient version of their Flash player, rather than the latest version with the closed-captions and text overlays and all that stuff.
- camus 14y agothat's the point , you cant keep up with the latest flash version = fail . You cant get good performances = fail , you cant run it on old browsers that dont have flash = fail . Nobody needs that. This has already been done , all the projects have failed. If i had skills i would not waste my time trying to fit a triangle in a star , i would develop tools to make perfect fitting stars. That's what people want.
- malandrew 14y agoInterestingly this has been my opinion of all the projects that attempt to create a bridge between native mobile APIS and javascript like phonegap and trigger.io. Don't get me know, they've been noble useful effects, but a lot of that effort should have going into projects like WebKit and Firefox to bring those native APIs to the browsers themselves.
- malandrew 14y agoDoh! "Don't get me wrong, they've been noble useful efforts" not "Don't get me know, they've been noble useful effects" Stupid autocorrect. TBH I prefer typos than autocorrect. At least with typos it looks like a typo instead of making you look like an idiot.
- mbebenita 14y agoThere's no need to keep up with the latest flash version. If you can render 90% of the legacy content out there (ads, animations, simple games) it's already good enough. You can always fall back on the real Flash player if you need to play a fancy game.
- deleted 14y ago[deleted]
- daenz 14y agoPreface: this is pretty cool. That said, is the payoff of implementing this enormously involved solution really worth it? I don't know why I feel like this, but something deep down pains me when I think of the man hours and frustration that had to have gone into something like this. Does anyone else know what I mean?
- supercoder 14y agoI agree, brilliant job but kinda depressing if no one really ends up using the results of his hard work. .. definitely skating to where the puck used to be.
- cookiecaper 14y agoWhile I understand that they want something that doesn't require installation, I think it's kind of sad that they felt they couldn't pick up on Gnash or LightSpark or some of the other good open-source Flash work out there. This is a nice concept demo; maybe they will choose to work on a grown-up Flash player instead now. Performance is bad enough without putting the JavaScript intermediary in there, and LightSpark is super promising. A worthy goal, but I hope they don't let NIH set them years behind the curve.
- nnethercote 14y ago> it's kind of sad that they felt they couldn't pick up on Gnash or LightSpark or some of the other good open-source Flash work out there The whole point is that doing it in JS avoids the need for a native code plug-in, which cuts off an entire avenue of security problems. Same story as PDF.js.
- cookiecaper 14y agoThere's a big difference between displaying a PDF file in JavaScript and compiling and displaying an active, real-time Flash game in JavaScript. A PDF file is just words and pictures on a page, same thing browsers have always done. They don't include animations, they don't accept user input, they don't connect to servers and stream files and send updates, and they definitely don't run real-time graphics code or path finding and collision detection algorithms. The applications of Flash make it a better candidate for native code instead of the performance wreck of a from-scratch JIT-on-JIT solution. I think it's a great demo and probably a useful experiment that can improve the quality of Firefox's JavaScript compilers, but I don't think it's a very serious candidate to replace Flash Player for its most common strongholds (for instance: that simple little car demo runs at 20fps on my machine, which I built last month and has an i7 3770K). And that's really what we need right now. The excuses to write this in JavaScript are pretty flat. You don't think they can figure out how to make an NSAPI plugin reasonably secure? You don't think they can get the code portable enough to work on multiple platforms? The biggest issue is probably mobile since many machines there use ARM, but Lightspark uses LLVM as its backend, which already supports ARM. I'm confident Mozilla's engineers can figure that out and give us a real replacement for the Flash player. I don't mean to imply that this project isn't impressive -- it is. But I hate to see them duplicate so much effort for a solution that is, by nature, performantly disadvantaged. We need a serious challenger to Flash Player (we've had enough toys) and Mozilla is in a good position to provide that, so I hope they choose to do so.
- camus 14y agothis project is a waste of time. The problem is not the player , but how flash can output content that use standard browser apis. This kind of emulation is a good demo , but doesnt work in the real world. Why whould i use that ? old browser will never support that tech ( < IE9 ) but they support flash , recent browsers dont need flash , what's the point ? It makes more sense to build tools similar to flash IDE that can export to HTML5 than wasting time trying to make legacy code run slow and blow up to the user's face ... been there , done that ...
- chadaustin 14y agoIt's not a waste of time for two reasons: 1) If it works, then it shows how far browser technology has come. Real examples are meaningful. 2) SWF files are content. In a Flash-less world we'd have no ability to experience Dice Wars or most Kongregate games or http://raditts.com/phyles/xiao3.swf http://raditts.com/phyles/xiao3.swf Consider this project an emulator for old things. :)
- async5 14y ago> or http://raditts.com/phyles/xiao3.swf http://raditts.com/phyles/xiao3.swf I was looking for this movie. Thanks!
- BrendanEich 14y agoPlatforms where Flash is not supported by Adobe, or not allowed by the OS vendor: - Linux - Win8 Metro, depending on the whitelist contents - iPad - iPhone - FirefoxOS (neé B2G) As Stan the Man says, 'nuff said! /be
- freditup 14y agoThe main advantage to Flash is that you get a much more mature language (Actionscript 3) to work with over JS and you also get a whole host of great APIs that are easy to use. (From ByteArrays, to the Camera class, to different blend modes and filters, easy Bitmap manipulations, etc.). Now, JS is starting to implement some of these things which is good, but they still vary across browser, only work on the most modern browsers, etc. So the advantages of Flash over JS (in my opinion) in short are: better language, better APIs, no tweaking for different platforms. Anyway, if Shumway was fully featured, it would definitely be a big benefit. But if it doesn't work cross-browser and doesn't support all the features of Flash/Actionscript 3, then you're losing some of the main advantages Actionscript 3 gives you, and you're almost just as well off righting things in JS.
- BrendanEich 14y agoYou seem up-to-date on AS3 but not on JS. JS has typedarrays (even in IE10) now. /be
- logotype 14y agoFirst of all, there are more things than typed arrays (vectors) in AS3, the main thing being a consistent runtime. Also the way you structure an AS3 project is different since the language supports packages/classes etc while in JS you (for better or worse) don't have these concepts so you end up with many different code styles. Even though browsers implement the some of the features, there are subtle differences in the implementations. This results, in real world scenarios, that this stuff are being abstracted away, layers and layers of abstractions, libraries for everything. I have my doubts that this SWF interpreter can be efficient.
- BrendanEich 14y agoThere are too many layers in all doomed software, whether written in JS or AS3. Subtle differences in implementations, you say? That is called the open web. Come on in, the water's fine. Pay no attention to the drowning plugins over in that cold corner... /be
- comex 14y agoThe demo errors out in Safari, apparently due to some weird issue with defineProperty and read-only properties. As big as a HTML5 fan as I am, considering Flash's cross-platform consistency, it's a bit ironic...
- mpweiher 14y agoSo that means I now have to disable JS as well as Flash?