Slashdot Mirror


Open-Source JavaScript Flash Player (HTML5/SVG)

gbutler69 writes "Someone has gone and done it. Tobias Schneider has created a Flash player written in JavaScript targeting SVG/HTML5-capable browsers. It's not a complete implementation yet, but it shows real promise. A few demos have been posted online. How long before HTML5/SVG next-generation browsers like Chrome, Firefox, Opera, Safari, Epiphany, and other Web-Kit based browsers completely supplant Flash and Silverlight/Moonlight?"

49 of 300 comments (clear)

  1. This is great! by the+roAm · · Score: 2, Funny

    Wait, Javascript? Oh shit. I can feel the slow already.

    --
    ~The roAm
    1. Re:This is great! by sopssa · · Score: 4, Informative

      Welcome back to 2008. There was major improvement in javascript engines during 2009 in all other browsers than IE and Firefox. Chrome and Opera have incredibly fast javascript renderers and they're pushing it even more in next Opera version.

    2. Re:This is great! by TheRaven64 · · Score: 5, Informative

      Why? Most of what a Flash applet does is run ActionScript, which is a dialect of JavaScript. The drawing in this will be done by the browser, rather than by a plugin, and the code will be run by the browser's JavaScript engine instead of the plugin's one. If anything, you'll see less memory usage because you'll only need one JavaScript VM instead of two.

      --
      I am TheRaven on Soylent News
    3. Re:This is great! by datapharmer · · Score: 2, Insightful

      Clearly you aren't on a mac. I can tell a website is running flash with my eyes closed on my mac because the fans turn on. Other than rendering large amounts of video, flash is the ONLY thing that causes my fans to come on with any sort of regularity. This is not a browser specific issue, it is a adobe wrote and anwful flash implementation for mac. I am all for a javascript replacement for flash if it gets rid of the adobe crapware. Adobe flash for mac might actually be worse than real media player was on pc in the 90s.

      --
      Get a web developer
    4. Re:This is great! by the+roAm · · Score: 2, Insightful

      That's mostly true, but I'm somehow doubting JavaScript, as implemented in most rendering engines, will be able to do any of the higher-level Flash stuff with any semblance of grace or speed.

      --
      ~The roAm
    5. Re:This is great! by Jurily · · Score: 4, Insightful

      Couldn't we just ditch Flash and use something less retarded?

    6. Re:This is great! by Zerth · · Score: 3, Interesting

      I dunno. The tiger demo(which appears to just display a picture of a tiger) maxes out 1 core in Chrome.

      The animated stuff barely tickles it, though. Odd.

    7. Re:This is great! by slim · · Score: 2, Insightful

      I thought it was useful. I had assumed it was Canvas.

    8. Re:This is great! by ByOhTek · · Score: 2, Insightful

      Don't feel particularly special. Adobe flash is horrid on ANY platform it is made for. Not just Mac.

      --
      Self proclaimed typo king, and inventor of the bear destroying coffee table (patent not pending).
    9. Re:This is great! by the+roAm · · Score: 4, Informative

      It's not odd, it's SVG. Rendering SVGs, especially ones with lots of lines and not a lot of solid shapes is quite CPU intensive.

      --
      ~The roAm
    10. Re:This is great! by Transfinite · · Score: 2, Informative

      Not true at all. Javascript engines are getting faster, a lot of effort, time and money is being put into making that so. Googles V8 engine for example. Also paired with the fact that HTML5 introduces a notion of concurrency into Javascript this is then even less of an issue. ~Unfortunately most people still think circa 1998 when talking about Javascript. Wrong. Javascript is key to the future of the web and not heavy inefficient server side solutions. Have a look at say node.js and see if you still think about Javascript circa 1998

    11. Re:This is great! by Ltap · · Score: 2, Insightful

      The answer to your question relies on a proper definition of "we". "We", to you, means everyone who uses the Internet. However, "we", in reality, are a small minority of people who know what they are doing and what they are talking about.

      It is similar to ipv6 - change can only happen at the level of big companies (or, in this case, video hosting sites like Youtube) who don't want to change for various reasons. HTML5 took forever to get here because it was designed to be easy to transfer to, but people have still ignored it the same way they have ignored web standards since their first conception. The only way to make people change is to make the HTML5 implementation easier than Flash implementation, which is difficult since so many people learn and are comfortable with Flash. Once HTML5 begins to have a little more impact and people (hopefully) learn it, we can all just move on, since nothing, as well all know, is easier than HTML.

      --
      Yet Another Tech Blog
      (but so much more, including game and movie reviews)
      http://yanteb.peasantoid.org
    12. Re:This is great! by IGnatius+T+Foobar · · Score: 2, Insightful

      Couldn't we just ditch Flash and use something less retarded?

      Bite your tongue. If anything replaces Flash it will be Silverlight. Do you really want Microsoft controlling the non-HTML portion of the Web? Do you really want Microsoft turning the Web into a Windows-only experience? Because that's what's going to happen if Flash is supplanted. Be careful wht you wish for.

      --
      Tired of FB/Google censorship? Visit UNCENSORED!
    13. Re:This is great! by TheRaven64 · · Score: 5, Interesting

      It's worth noting that Adobe and the browser makers optimise their VMs for different requirements. Flash tends to run very long-running things, like games which use a big chunk of CPU for several minutes at a time. JavaScript in a browser tends to do relatively simple things and uses a tiny bit of CPU. The main requirement for Flash is efficiency of generated code, while for JavaScript it's load time. The test suite that the WebKit team use runs in a couple of seconds on a decent computer, while a typical Flash game will often take at least 10 seconds to download all of the image and sound files that it needs. This gives the Flash VM a little while to spend compiling and executing the code.

      There are, roughly speaking, four ways of implementing a programming language, although the boundaries between them are sometimes blurred. From slowest to fastest, these are:

      1. Interpreting the AST (or even parse tree). Whenever you run a bit of code, you do a traversal of the tree and execute each node in turn. This is how JavaScript was implemented in browsers until a couple of years ago. It's very slow, because something like 'a = b' involves three AST nodes and so you need at least three function calls for a trivial assignment.
      2. Compiling the AST to bytecode and interpreting the bytecode. Bytecodes are instruction sets for virtual stack machines where each opcode is one byte. You can implement them with a jump table, so the interpreter is fast (typically 50% native speed or more). A simple assignment would be a push value, push address and pop value at address bytecode instruction, which would expand to half a dozen or so native instructions. Significantly faster than interpreting an AST.
      3. Just-in-time compiling to native code. Functions (or traces in something like Tamarin) are compiled to native code as they are needed, or after running them in an interpreter a few time and getting profiling information. This can produce the fastest code, because it can be tailored for that specific run of the program, but the cost of generating the code has to be added to the cost of running it every time that you run the program. Great for long-running programs, not so good for other things.
      4. Statically compiling to native code. This produces good code. It doesn't have as much profiling information, but it also can spend longer optimising because the end user isn't waiting for the compiler to run, so it tends to be faster than JIT compilation in practice.

      Tamarin, the VM in Flash, uses the JIT approach, while the WebKit JavaScript VM is a bytecode interpreter.

      One of the hippyware projects that I maintain is a compilation infrastructure for dynamic languages, with an AST interpreter a JIT and a static compiler. On one of my test programs, running the JIT-compiled code took 0.023 seconds, but compiling it took over 2 seconds. In contrast, running it in the interpreter took about 0.9 seconds. Although the JIT-compiled code was significantly faster than the interpreted code, the total running time was faster. If you added a loop so that the test program ran twice, it was a bit faster in the JIT, and if you made it loop ten times it was significantly faster.

      For most browsers, the JavaScript for a given page uses a fraction of a second of CPU time, so spending even one second generating optimised machine code from it is not productive. In contrast, Flash code can spend several CPU-minutes running, so if spending five seconds on optimisation makes it twice as fast then it's time well spent.

      --
      I am TheRaven on Soylent News
    14. Re:This is great! by NightLamp · · Score: 2, Interesting

      Can't we ditch JavaScript and _just_ use Flash - a nice blockable scripting engine that isn't integrated so deeply with HTML that disabling it breaks scores of sites with otherwise useful information?
      If I want maximum battery life I block scripting, period. If I want fancy UI doo-dads and continuous browser-server communication I can enable Flash. What I don't want is great gobs of busted HTML when I don't want to run any kind of scripting engine. Just because you can doesn't mean you should, I'd like it if JavaScript became a "can't".

    15. Re:This is great! by Shining+Celebi · · Score: 3, Informative

      Welcome back to 2008. There was major improvement in javascript engines during 2009 in all other browsers than IE and Firefox. Chrome and Opera have incredibly fast javascript renderers and they're pushing it even more in next Opera version.

      Firefox 3.5 was released in June, with new Javascript improvements via Tracemonkey (a JIT compilation engine) that make it comparable with Chrome. I just tried out the demos and Firefox does not noticeable lag and it did not use more than 10% CPU, which is about the same as a normal Flash video for me.

    16. Re:This is great! by dave420 · · Score: 2, Insightful

      When that's possible, sure! Until then everyone will keep using Flash, as it's released, wide-spread, fast, and works.

    17. Re:This is great! by amicusNYCL · · Score: 2, Interesting

      The main uses that come to mind are video, audio, and non-video animation. The company I work for makes online training courses which are all done in Flash, there's no suitable alternative to Flash in that context (unless you count Silverlight, which I don't).

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
    18. Re:This is great! by promythyus · · Score: 4, Funny

      He said *less* retarded...

    19. Re:This is great! by h4rr4r · · Score: 5, Insightful

      How about just posting the damn videos? All modern browsers will play video fine.

    20. Re:This is great! by ShadowRangerRIT · · Score: 3, Interesting

      IE8 came out in 2009, and from my understanding it massively improved JavaScript performance. Still not on par with the competition, but within an order of magnitude. FF 3.5 (with TraceMonkey) was released in 2009 as well, and had a similarly impressive boost to JS performance. Just because neither is quite at a Chrome level doesn't mean they aren't *much* faster than they used to be.

      --
      $_ = "wftedskaebjgdpjgidbsmnjgcdwatb"; tr/a-z/oh, turtleneck Phrase Jar!/; print
    21. Re:This is great! by amicusNYCL · · Score: 2, Insightful

      Some video and a set of radio buttons, huh? Educate thyself.

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
    22. Re:This is great! by tepples · · Score: 2, Interesting

      Not all videos are made of pixels gathered with a camera. JPEG is to MPEG as SVG is to what? Which vector animation codec works in both Firefox and Safari?

    23. Re:This is great! by Acaeris · · Score: 2, Insightful

      erm, I hate to ask but what other browser are you referring to?

      Safari's window code may be proprietary but it uses Webkit as it's rendering engine, which to my knowledge is not only open source but the most standard compliant at the moment. http://webkit.org/

      Chrome also uses Webkit and Chromium is the open source version of it. http://code.google.com/chromium/

      Gecko is the open source renderer for Firefox and most of the other browsers that appear on a website's stats.

      Opera is the only proprietary browser other than IE and it's pushing standards just as much as Gecko and Webkit.

      am I missing something?

  2. Now if they could by mandark1967 · · Score: 3, Funny

    just duplicate the security vulnerabilities that Adobe provides us, we can finally put Adobe out of business!

    --
    Sig Follows: "Suppose you were an idiot. And suppose you were a member of Congress. But I repeat myself." -- Mark Twain
    1. Re:Now if they could by mandark1967 · · Score: 2, Interesting

      I make it a point to verify, with each update of Flash, that my settings to automatically deny flash based cookies remain intact.

      I hate the way you change configuration with Flash and would gladly do without it if something open-source could take its place.

      I just hope the people working on this keep in mind that configurability and security are as important as performance.

      --
      Sig Follows: "Suppose you were an idiot. And suppose you were a member of Congress. But I repeat myself." -- Mark Twain
    2. Re:Now if they could by clang_jangle · · Score: 5, Informative

      flash based cookies, which are not that easy to block and/or delete for the user, are used by all advertisers and other bastards, spying on you

      Trivial to defeat, at least in *.nix. Just remove all write permissions to the ~/.adobe and ~/.macromedia directories, after deleting all the cookies within. Buh-bye, flash cookies. Also makes flash work noticeably faster.

      --
      Caveat Utilitor
  3. Checked out the demos on my iphone by Anonymusing · · Score: 4, Informative

    I checked out the posted demos on my iPhone. Although they were a tad sluggish (particularly the star fade-in on the first demo), frankly, it wasn't bad. Some of the sluggishness could have just been because the demos are getting Slashdotted.

    Personally, I'm a little more interested in PhoneGap, which lets you use JavaScript to create iPhone apps (outside the browser).

    --
    Liberal? Conservative? Compare perspectives at Left-Right
    1. Re:Checked out the demos on my iphone by Sir_Lewk · · Score: 2, Informative

      Javascript runs on your hardware, not on whatever server it was hosted on. A site getting slashdotted will make a page more sluggish to load, but not run.

      --
      "linux is just DOS with a UNIX like syntax" -- Galactic Dominator (944134)
  4. Sort of a good idea by nine-times · · Score: 2, Interesting

    I'm not sure what to think. I love the idea of not needing to install Flash, but I also like being able to block annoying animations by not installing Flash.

    I think overall, this isn't where things should head. It'd be much better if Flash were to simply work by exporting valid HTML5, CSS, and Javascript. Maybe there are some other advantages to the SWF format, but I'm not aware of them.

    1. Re:Sort of a good idea by bersl2 · · Score: 3, Informative

      I'm not sure what to think. I love the idea of not needing to install Flash, but I also like being able to block annoying animations by not installing Flash.

      And this is why we have things such as AdBlock (and variants) and NoScript. Presumably, if and when SVG and the HTML5 media tags start being used much more, there will be browser controls for whether the media should be run or ignored.

  5. Not SVG by SolitaryMan · · Score: 2, Interesting

    First of all, the main usage of Flash (for me) is video and I don't expect anyone to write h.232 codec using javascript and canvas anytime soon.

    SVG has failed a long time ago. Correct me if I'm wrong, but there is no good way of putting it in the DOM unless you are using XHTML, which you shouldn't, and all other ways of getting it to the client are non-standard and handled differently by different browsers.

    --
    May Peace Prevail On Earth
    1. Re:Not SVG by Jeffrey+Baker · · Score: 4, Insightful

      Why shouldn't you use XHTML? By the way, SVG made its way into HTML5 and it's much more useful than canvas so I think the reports of SVG's death are greatly exaggerated.

    2. Re:Not SVG by amicusNYCL · · Score: 2, Informative

      Why shouldn't you use XHTML?

      1) There's no practical advantage to using XHTML over HTML.

      2) There's no XHTML2. The future is HTML5.

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
  6. Re:speed by slim · · Score: 2, Funny

    The language needs better ways of manipulating bits and bytes.

    A hidden canvas element?

    (I feel dirty now)

  7. less than 100% is good by f3r · · Score: 2, Informative

    anything using less than 100% cpu in linux is better than Flash. Therefore there can in principle be nothing worse than Flash. Unbeatable, indeed a hard goal to achieve.

  8. OMGWTFPDF by shutdown+-p+now · · Score: 5, Interesting

    Great! Now, please, can someone write a PDF renderer in JS + HTML5 Canvas, so we can get rid of the browser killer plugin that is any PDF viewer out there?

    1. Re:OMGWTFPDF by Anonymous Coward · · Score: 4, Insightful

      Even better, maybe someone could write a Flash PDF viewer, and then we could view our PDFs using this flash interpreter.

      (Ohboy. The layers of cruft involved in that concept have just given me a cold shiver up my spine)

    2. Re:OMGWTFPDF by ReinoutS · · Score: 4, Insightful

      The real WTF is that you are trying to view a PDF in your browser in the first place. Try opening it with a real pdf viewer instead.

  9. Before you get all excited... by Qubit · · Score: 5, Informative

    ...according to the article his code only supports the SWF 1.0 format, and he's currently working on adding support for the SWF 2.0 file format.

    Adobe Flash 1 and Flash 2 (which I'm going to guess might roughly line up with SWF 1.0 and 2.0), were released in 1996 and 1997, respectively. As in, over a decade ago.

    Much larger, more long-term projects like Gnash have been working on completing a compliant Flash client for several years and still don't have support through Flash 8, 9, and 10. It's apparently a lot of work to support all of the different pieces of Flash, especially as it turns out that the SWF spec has been completely overhauled several times over the past decade, resulting in wide differences between things like ActionScript 1, 2, and 3.

    So while I wish this effort all the best, it would require a lot of time/energy/talent to make this client have the coverage necessary for, say, internet video sites to work.

    --

    coding is life /* the rest is */
  10. How long? How about 'probably never' by Quarters · · Score: 4, Insightful

    Ah yes, another stab at (this is a killer!). Those predictions never pan out. Specifically for this: * All existing websites would need to be retrofitted to host .swf (.flv?) movies differently * All popular browsers would need to embrace HTML5 video playback * Microsoft would have to emphasize this over their own product. * Adobe would have to emphasize this over their own product. * The marketing department being utilized for this tech (at this time that would be 'no one') would have to be better funded and more highly motivated than both the Microsoft and Adobe marketing departments * The vast majority of web users would have to care. So, yeah, no.

    1. Re:How long? How about 'probably never' by mounthood · · Score: 2, Interesting

      * All existing websites would need to be retrofitted to host .swf (.flv?) movies differently

      No, just enough of the big sites like Youtube. If a Flash replacement isn't advanced enough to do this it won't get widely used, but most people don't care about the little sites.

      * All popular browsers would need to embrace HTML5 video playback *Microsoft would have to emphasize this over their own product. * Adobe would have to emphasize this over their own product.

      uh... do you think Flash would magically disappear if a competitor arrives?

      * The marketing department being utilized for this tech (at this time that would be 'no one') would have to be better funded and more highly motivated than both the Microsoft and Adobe marketing departments

      If Firefox included it by default, it would be in almost 1/4 of all browsers globally. Sites will pay attention to that.

      * The vast majority of web users would have to care.

      No, they just have to use a modern Free browser that includes a reasonable Flash replacement.

      A Firefox embedded implementation would almost certainly allow users to switch to a different plug-in, like the canonical Adobe version. Change does happen; it's not impossible to replace Flash and there is no prerequisite for 100% compatibility.

      --
      tomorrow who's gonna fuss
    2. Re:How long? How about 'probably never' by Xtravar · · Score: 2, Interesting

      Assuming this project gets far enough (and I doubt it will), there could easily be a Firefox plugin that imports this Javascript whenever it sees typical embedded Flash. Also, pandering to iPhone users who don't have a Flash plugin would bring this project into the mainstream almost over night.

      --
      Buckle your ROFL belt, we're in for some LOLs.
  11. Doesn't support AS3 by Steve+S · · Score: 3, Informative

    According to the list of supported swf tags (http://wiki.github.com/tobeytailor/gordon/swf-tag-support-table ), it does not support DoABC, which means that it does not support Actionscript3. So basically, it only supports the parts of flash that really annoy people: Animations. This won't let you play many neat flash games, or replace Flex, or play a movie designed for Flash9 (introduced in 2006) or later.

    As an Actionscript hobbyist, I love the idea of an open source implementation of the player. But so far, none of the open source alternatives support the features I actually like: Actionscript3. It's a strongly typed language with real classes, and it's compiled to bytecode rather than interpreted (mostly). Javascript has come a long way, but it still sucks if you like strongly typed variables.

    Keep trying, Tobias. And if you get that byte-level access, let the world know.

    --
    ------- Driver carries less than 64K of cache.
  12. Re:Ummm ... by Transfinite · · Score: 2, Insightful

    Umm because IE is shit, lagging about 3 years behind the rest. They STILL have not managed to produce a *fully* standards compliant browser.

  13. Now seriously... by LunarEffect · · Score: 2, Insightful

    I'm impressed! Flash has pretty much become an integral part of the web, yet you always had to download and install an extra plugin to be able to view flash content. Having an implementation of the flashplayer written in a language that can be executed by every major browser reguardless of the operating system is an incredibly useful thing to have.
    And now with ever faster Processors and better implementations of JavaScript interpreters, I think its far from a bad thing to put more work into the hands of interpreted languages.

  14. JavaScript audio? by tepples · · Score: 3, Insightful

    ECMAScript and open graphics standards?

    What about open sound standards? Can the <audio> element of the HTML DOM support playing multiple instances of one sound at once, or varying the playback rate or volume of audio, or synchronizing vector animation to the audio? The common uses of audio that I've seen in SWF objects on Newgrounds makes use of all of these Flash Player features.

  15. Two use cases from Newgrounds by tepples · · Score: 2, Interesting

    99.99% of what flash is now used for is video.

    Does "video" in your comment refer to vector animations or just compressed pixels? And does it include video games? I see both vector animations and games on Newgrounds.

  16. Whats needed to kill flash, let me tell you ... by BitZtream · · Score: 2, Insightful

    An editor that compares to the Flash Authoring tools.

    Thats it.

    There isn't anything special in Flash that can't be done with Batik or Opera's latest SVG implementations except sound and video, which you can handle in HTML5.

    The only thing thats needed is a good authoring toolset so that graphics gimps can produce their warez without having to use notepad.

    --
    Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager