Open-Source JavaScript Flash Player (HTML5/SVG) 300
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?"
This is great! (Score:2, Funny)
Re:This is great! (Score:5, 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.
Re:This is great! (Score:4, 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.
Re:This is great! (Score:4, Informative)
Re:This is great! (Score:4, Informative)
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.
Re:This is great! (Score:4, Interesting)
Re:This is great! (Score:5, Informative)
Re: (Score:2, Insightful)
Re: (Score:2, Informative)
Re: (Score:3, Insightful)
I thought it was useful. I had assumed it was Canvas.
Re:This is great! (Score:5, Insightful)
Couldn't we just ditch Flash and use something less retarded?
Re: (Score:2)
What do you suggest as a replacement for the functionality provided by Flash?
Re: (Score:2)
ECMAScript and open graphics standards?
Or is that what Flash was originally slated to be?
Re: (Score:3, Insightful)
Re: (Score:2)
JavaScript audio? (Score:4, 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.
Two use cases from Newgrounds (Score:3, 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.
Re: (Score:3, 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).
Re:This is great! (Score:5, Insightful)
How about just posting the damn videos? All modern browsers will play video fine.
Re: (Score:3, Interesting)
Re: (Score:3, Insightful)
Some video and a set of radio buttons, huh? Educate thyself. [tracorp.com]
Re: (Score:2, Insightful)
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 ha
Re: (Score:2)
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.
You know, the HTML5 standard isn't even complete yet.
Re: (Score:2)
Re: (Score:2)
Then trying to get them to understand that their desire for something similar on their site requires using something despised by a large number of geeks (i.e. Flash).
Fixed that for you.
Most people on the Internet think Flash is just part of it. And many of them (I'd guess most) actually like it.
Re: (Score:2)
So, everyone who doesn't accept the One True Internet gets written off as a geek? Fine, next time fix your own damn cupholder.
Re: (Score:3, Insightful)
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.
Re:This is great! (Score:4, Funny)
Re: (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
Re: (Score:2)
For you younger folks or older folks with limited mental faculties, Pear pc was an emulator of a powe
Re: (Score:2)
Re: (Score:3, Insightful)
Re: (Score:3, Insightful)
Don't feel particularly special. Adobe flash is horrid on ANY platform it is made for. Not just Mac.
I don't think it will change much (Score:2)
I mean its great and all, it means that this new "flash" player will probably end up working across all the browsers eventually, and without the security vulnerabilities and downsides to the flash plugin.
But I think in the end - Flash is still going to be used to create the content. Adobe will put more effort into optimizing it, and then a lot of "regular" people will just end up prefering the flash plugin.
I mean Gordon is a server side installation, which means I personally can't start using it everywhere
Re: (Score:2)
You must not be using Firefox... let me help you with that: http://getfirefox.com/ [getfirefox.com]
I've found that I can inject just about anything I want into the browser that I run on my machine, isn't this the point of a bookmarklet? For that matter isn't that how most browser add-on's work, including the existing flash player? They extend the page as sent from the server (which by it's nature is either textual or binary, but is in no way inherently feedback oriented).
As for using Flash to create the content... once upon
Re: (Score:2, Insightful)
and java isn't slow. It currently runs about 2-3 times slower than c++ for nearly all applications, 2-3 times faster than .net CLR and about 10-20 times faster than scripting languages. In some case, though admittedly rare, java exceeds the performance of c++.
Re: (Score:2, Insightful)
For long-running, non-interactive applications, sure. As you say, in terms of raw performance Java is only 2-3 times slower than C++, which still makes it faster than CLR or most scripting languages. However, in the areas of start-up time and GUI performance Java's reputation for poor performance is well-deserved. This may not impact its usefulness for servers, but it makes all the difference in the world when it comes to desktop applications.
Re: (Score:2)
Don't know why you got modded Offtopic when your point is a fine response to the GP. Java does have fine performance (for most purposes), but it suffers from start-up times getting the virtual machine up and running. People have a simple reaction to such programs. They start it, they find themselves waiting for it to get going, and they say: "This is sooooo slow." Doesn't much matter what happens after that. The impression is made.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
IE is improving, and improving at a high rate.
Problem is, when you are light years behind the competition, a high rate of improvement still requires a long time for catch-up (if it ever happens, given that the competition are all moving targets themselves).
Re:This is great! (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:
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.
Re: (Score:2)
speed (Score:2)
So I guess the only thing holding it back is its performance (one assumes there are going to be fewer security and download/update issues :)
The blue demo seemed acceptable to me, but I wonder if it'd suffer as more stuff was added?
Still - top marks for that man, take the afternoon off.
Re: (Score:2)
I would say that the main thing holding it back is the total lack of a high-performance way to address bytes in JavaScript. The state-of-the-art for decoding binary protocols in JS is to use charAt and charCode to grab a character at a certain offset in a string, which throws off a phenomenal amount of garbage to be collected and is tremendously slow as well.
The language needs better ways of manipulating bits and bytes.
Re: (Score:3, Funny)
The language needs better ways of manipulating bits and bytes.
A hidden canvas element?
(I feel dirty now)
Re: (Score:2)
Re: (Score:2)
For some reason, all of them cause the "Aw, snap" message in Chrome (4.0.249.64) whenever I hover the mouse over them and move it around a little.
Re: (Score:2)
Re: (Score:2)
I'm using FF 3.5, so its not so bad - I might try chrome in a few days (after the slashdotting) to see what its like there.
The answer about byte manipulation was an interesting one, as a C/C++ dev I take such things for granted, but "generating a lot of garbage" means there's a lot of string copying going on under the covers which I know is a tremendous hit on system resources. I'm hopeful that it'll be improved though - Google has too much at stake :)
Now if they could (Score:3, Funny)
just duplicate the security vulnerabilities that Adobe provides us, we can finally put Adobe out of business!
Re: (Score:2)
Not as funny as it sounds: 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
Re: (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.
Re:Now if they could (Score:5, Informative)
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.
Re: (Score:2)
Checked out the demos on my iphone (Score:5, Informative)
I checked out the posted demos [paulirish.com] 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 [phonegap.com], which lets you use JavaScript to create iPhone apps (outside the browser).
Re: (Score:3, 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.
Re: (Score:2)
I know this.
While JavaScript runs on the local box, Flash typically begins running as it downloads, so an animation may stutter if it is struggling with the download. I was assuming that this remained true with this JS interpreter, and surmised that some of the sluggishness could have been due to the SWF file downloading slowly; however, I could be wrong. The code might need to download the whole file before interpeting it.
Re: (Score:2)
Re: (Score:2)
Which browser are you using?
I was using Safari on my iPhone.
On my desktop, the demos are fine.
Sort of a good idea (Score:3, 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.
Re: (Score:2)
Re: (Score:2)
As an expert in ignoring things, I can vouch that it's easy to ignore things which you don't see. So my advice is to stop using the web and go outside more. That way you can ignore online advertisers, email and more! As for ignoring other people when you go outside, carry a bloody shovel over your shoulder and splash a little fresh blood on your clothes. Most people will go the other way.
Perhaps you wanted someone who was an expert in HTML5? I don't know those people, everyone seems to run away when they se
Re:Sort of a good idea (Score:4, 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.
Not SVG (Score:3, 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.
Re:Not SVG (Score:5, 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.
Re: (Score:3, 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.
Re: (Score:2)
HTML5 includes XHTML5, so although it is true that XHTML2 is dead, it is also irrelevant.
http://www.whatwg.org/specs/web-apps/current-work/#the-xhtml-syntax [whatwg.org]
Re: (Score:2)
Tons of shit doesn't work in IE.
Re: (Score:2)
Which inclues an XML syntax. Any browser which supports HTML5 will also have XHTML5.
Re: (Score:2)
As someone rather new to flash, I'm not so sure how flash video works.
My assumption has always been that flash has support for h263 and other codecs coded into the plugin itself, so no one is writing flash actionscript to actually handle the codecs. If that's the case, the javascript flash implementation could likewise just pass the video decoding/rendering off to code in the browser designed to do that... unless I'm way off base, and people are actually writing actionscript for the video handling code, whi
Re: (Score:2)
The thing is, if the requirement is "Render a video at this coordinate on the page, with this size", the javascript implementation could simply go "Hey, pass that off as an and let another plugin handle it." Firefox's HTML5 code is being set up to handle an external supplier, for the linux case, gstreamer, in which case Firefox should be able to do html5 video with whatever codecs the system has available.
Re: (Score:2)
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.
No, but if your browser supports the video tag and you have the correct codecs installed then something like this can implement the Flash video APIs in terms of that.
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
You should use XHTML. Then you can mix HTML, MathML, and SVG in the same document, and have elements from all of them in the same DOM. The entire point of XHTML is to allow different XML formats to be used in the same document. Saying 'I want to do this without using the solution that was specifically designed for this exact problem' is a ve
Re: (Score:2)
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.
But why should they when your OS already has a perfectly good decoder? Using Flash for video playback was an ugly hack to begin with.
It won't be a quick transition. (Score:2)
How long before HTML5/SVG next-generation browsers [...] completely supplant Flash and Silverlight/Moonlight?"
I can't offer any informed opinion on that, but I can say that Flash and Silverlight/Moonlight will go down kicking and screaming. Much like the IE6 optimized websites that will continue to use them for many years to come.
less than 100% is good (Score:2, Informative)
Must be an iPhone user (Score:2)
For anybody else, this would just be a crazy waste of time. Wish Apple would just allow Flash on the iPod/iPhone
Re: (Score:2)
I agree. Apple is just making life difficult for its users. Espectially because the iPhone doesn't multi-task that means if you wanted just use 100% cpu sure it will drain your battery faster but it is not like you are slowing down other apps.
OMGWTFPDF (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?
Re:OMGWTFPDF (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)
Re:OMGWTFPDF (Score:5, Insightful)
Re: (Score:2)
Exactly! I have a major "WTF?" moment every time I see people opening PDFs in their web browser. Drives me nuts. And Mac people are all up in arms because Chrome on Mac doesn't (or didn't -- it may be implemented now) open PDFs in a plug-in. To me, that's a feature, not a bug.
Re: (Score:2)
Re: (Score:2)
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?
Hopefully you've disabled embedded PDF viewing a long time ago, given the potential security issues..
Re: (Score:2)
I've never understood the logic of viewing PDF's inside the browser via plugin; I can understand it for flash or java, where they provide certain functionalities and integrate within the web page, but don't see why you'd want to use a PDF in-browser, which doesn't integrate with the rest of the site. Even worse is when the notoriously corpulent Acrobat plugin starts to load, your browser tends to either freeze (thanks IE6) or act like it's just snorted a gram of ketamine.
I intentionally disable PDF plugins
Re: (Score:2)
I've never understood the logic of viewing PDF's inside the browser via plugin; I can understand it for flash or java, where they provide certain functionalities and integrate within the web page, but don't see why you'd want to use a PDF in-browser, which doesn't integrate with the rest of the site.
It depends on the nature of the PDF. If it's a long windy document, then sure, I'll download it and read it separately. But, for example, a lot of C++0x papers are small (1-5 pages) PDFs, and when reading comp.std.c++, I have to view some random ones all the time. It doesn't make any sense to download them just for one view, and I never know when (and if) I'd need to view that one again. It's so much easier to just open the list [open-std.org], pick the paper I want, and have it open right there and then in the same windo
Too much fuss (Score:2)
The work that this guy did is amazing, no doubt. But the player supports SWF v1. The current version is 10!
Gnash already supports v7 and some features of v8/9 and is still not very usable.
Doing simple animations is one thing. Do you really expect to have a decent AS3 interpreter running in javascript? No question about video of course.
On the other hand this player could have some niche applications. If someone knows flash, needs some simple animations without violating standards and without messing with JS/
Re: (Score:2)
I can't wait for the Firefox addon (Score:2)
So I can finally switch to 64 bit firefox. And yes, I know that there is a Linux plugin available, but I don't use Linux at home.
Before you get all excited... (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 [gnashdev.org] 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.
How long? How about 'probably never' (Score:5, Insightful)
Re: (Score:3, 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 alm
Re: (Score:3, 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.
Doesn't support AS3 (Score:4, 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.
Now seriously... (Score:2, Insightful)
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 i
Replacing flash/silverlight (Score:2)
Haha (Score:2)
Gee, I dunno. How long will we have to support IE6?
Whats needed to kill flash, let me tell you ... (Score:3, 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.
Re: (Score:2)
Then there are cases where the best name for a variable is something like 'value', 'string', 'data', 'array', or 'pointer' where using those instead of a single character doesnt help anybody.
Library programmers are more familiar with using single letters, because many variables are often entirely abstract and simply dont have a concrete meaning. What should you call the input to a sort function? 'arrayToB
Re: (Score:2, Insightful)