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?"

22 of 300 comments (clear)

  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. 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 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. 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
  4. 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
  5. 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.

  6. Re:This is great! by Jurily · · Score: 4, Insightful

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

  7. 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.

  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. 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. 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 */
  11. 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.

  12. 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.
  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: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.

  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. 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.

  17. Re:This is great! by promythyus · · Score: 4, Funny

    He said *less* retarded...

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

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

  19. 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