JavaScript Has Won: Run Flash with Mozilla Shumway and Develop Silverlight in JS with Fayde
Well this is some amazing news that has been a long time coming. You can take your Flash apps and run them without Flash, and take your Silverlight apps and (almost) run them without Silverlight.
If you still don't think JavaScript has won the web, please read on.
Shumway - Flash in JavaScript and HTML 5
The Mozilla Project "Shumway" has been a long time coming (as long ago as 2012, but it's now ready to be looked at more deeply).
Chris Peterson, a Program Manager on the Mozilla Shumway says:
"Shumway is in a race to stay relevant as Flash fades from the web, but there will always be a long-tail of Flash content that would/will be lost when Adobe or browsers stop supporting the Flash plugin."
Think about that. We've all largely got "Evergreen Browsers" now that update themselves as often as weekly, but sometimes it feels like Adobe Flash is being attacked daily, so we're told to update that as well. Flash itself has more than fallen from grace, as Chris points out, it's fading from the web itself. Fast forward a year or so when there is no more Flash installed, but there's still Flash on the web. Enter Shumway - it's a renderer for SWF (Flash files) without native code! Shumway literally.
Why is it called Shumway? Again, Chris:
"The name "Shumway" is derived from "Gordon Shumway", the actual name of the TV character ALF: Flash -> Flash Gordon -> Gordon Shumway -> Shumway."
That's awesome. What else is awesome? "Shumway is written in TypeScript. It has an ActionScript interpreter and a JIT that generates JavaScript, compiled using eval()."
So Shumway is an HTML experiment that uses TypeScript (a modern typed JavaScript compiler/transpiler) to read ActionScript and resources and JIT the result into evaluated JavaScript. Fantastic. It's also open source and on GitHub. Even better, the Firefox Nightly is using Shumway for Flash videos on Amazon.com. This is the beginning of their test, I presume, to sunset Flash in Firefox.
Fayde - Silverlight in JavaScript and HTML5 Canvas
At the same time, there's The Fayde project. Also Open Source, Fayde also compiles to JavaScript. But Fayde transforms Silverlight into HTML5 Canvas and JavaScript! It's an implementation of a XAML engine in JS. Here's a near-Silverlight implementation of the classic Todo application, expressed on the web without plugins. Not enough? Here's a complex Fantasy Football app written in a Silverlight-like environment but running in your browser, again, without Silverlight.
To be clear, there are significant architectural differences between these two projects. Shumway reads the binary SWF format and tries to Be Flash, while Fayde is reimagining, if you will, that takes the Silverlight concepts of ViewModels and Views in XAML and adds TypeScript (a comfortable language for the C#-familiar) with the result rendered on a Canvas. It's not a Silverlight Emulator, it's a Silverlight-like implementation and app development pattern for HTML5. It's open source, and they are looking for participation, so head over and get involved! Fayde may be the Silverlight migration strategy you've been looking for.
Aside: From my perspective, it's not unreasonable to imagine taking something like JSIL (listen to my podcast on this amazing project) or a similar IL->JS system and combine it with Fayde to somehow run XAPs as well.
I love how crazy JavaScript is and what people have been able to do with it. Now, go run this PC Emulator (~virtual machine) written by Fabrice Bellard in JavaScript. It's Linux, on a 486, in your browser, in JavaScript. *brain explodes*
Have a lovely day and enjoy today's Open Web.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
What's important here is FINALLY we are on the path to build a build-once-run-everywhere application, courtesy of JavaScript: You can take Fayde and use TypeScript ("all the way down"), or choose CSHTML5 and use C# ("all the way down") -- which, again, MSFT should have done after Mix'11! Haha, as a Silverlight v1 developer, I will NEVER forgive you guys for stealing the past 4 years of my life. ;p #bitter
Anyways, the point is that JavaScript isn't just an application language (Fayde), but an assembly language (CSHTML5/JSIL) as well. It has indeed won the web (and I would argue, everything else once hardware/performance catches up to it). Pick your poison!
Fayde shows tremendous progress and I appreciate the developer's efforts. However, in our effort to embrace JS it is important to realize that Fayde is not a likely endpoint for existing Silverlight applications. Fayde's primary focus is around XAML and TypeScript scenarios, not Silverlight.
Have you tryed it?
https://github.com/mozilla/shumway/issues
Yabe - Indeed. All beta software has issues. But if we can emulator a complete PC in JavaScript, I'm sure that Shunway can fix their issues for Flash.
Scott, do you think this (and projects like asm.js) will turn all applications to be Javascript applications but no body is actually writing Javascript?
Also, a quick word about TypeScript and making it friendly to JS. It really comes down to what you are using for your backend technology now as far as adopting TS goes. That's really the key here. If you are doing node.js, then Fayde/TypeScript makes perfect sense. However, if you are using C# as your backend, then JSIL/CSHTML5 will make more sense (I still think an entire MSFT division should be dedicated to making an official JSIL.NET, but hey).
Otherwise, you will have 1 language for client, and 1 language for backend, and you won't be able to share code between the two... and that's exactly the scenario that Silverlight addressed and made possible. That is, you could share code (extension methods, especially) and components between backend and client and have them work exactly the same between the two tiers.
My final (hopefully, *smile*) word about this is that (speaking to @Yabe's point)... we're about another year or so before these projects are really viable. I for one will be focused on Xamarin.Forms during this time as Xamarin is more mature and has the strongest cross-platform solution in .NET currently. However, if they do not adopt a JavaScript-based solution like JSIL, they will be in jeopardy (IMO) going forward.
Thanks for posting this great article, Scott... and for engaging your readers!
Awesome article! It's truly exciting as a Silverlight guy to see these projects get some traction. Thanks for putting this post together and bringing some additional eyes on these amazing projects.
Also, I want to be independent of the security and stability of the browsers. (Silverlight App Mode..)
That was the advantage of Silverlight !!!
But why is this broke by MS ?
Also there is the funscript project that does something similar but can use d.ts typing to bring in almost any js lib
Does look like js is becoming assembly of the web (sure I read that somewhere ;))
And no it is not about that I cannot write JS. I know how to write JS and I don't want to do it.
Could you please advocate making Lightswitch (the Silverlight part) open source? Microsoft has abandoned us Lightswitch developers (no product development, no roadmaps, no communication with the community...), so I think that would be the perfect solution for everybody.
Anyway, I'll take a look to Fayde, it could be a migration path for my current Lightswitch applications.
Thanks for your worderful blog!
Mario
1) Open source SL
2) Create a SL -> JSIL+canvas compiler/renderer backend. I doubt it would even take them more than 3-6 months, and everyone would have been happy.
Silverlight strength, even today, is its tools, where developer and designer can work efficiently together.
We developer apps in SL still, and we are still 2-5 times more productive in that platform than anything else when you get into more complicated applications.
SL is a sad sad story from Microsoft, whomever made those decisions I hope is long gone, it is possibly Microsoft's worst ever choice. It is even very likely responsible for the slow update of Windows RT/Store applications. People are just not ready to take that risk, so everyone is waiting for someone to make sure the ground is stable before we walk on it again.
Someone needs to make a new type of browser that is built as an actual platform for applications to replace this crap-tastic trio.
Hey Scott, we should find a way to translate .NET apps to Canvas!
I hope to see flash content on mobile safari for a long time, with shumway this is technically possible.
Unfortunatly the additional javascript layer is really slow compared to the native C++ flash player executable.
i have tested the simple as3 race game, it's 60 fps when played with flash player.
i wonder if it would be possible for adobe to create a real html-flash-player with tool like emscriptem that convert c++ to js.
A true Silverlight to JS emulator would be interesting as well and definitely have value for my work, as we have a lot of legacy stuff in Silverlight.
Thanks a lot for the nice writeup and kind words. You're right about playing videos on Amazon being the very first step of a broader plan to test Shumway for more and more content. It's restricted to Firefox Nightly for now, but enabling it there allows us to get substantially more feedback. Not necessarily from people who spend their days watching product videos on Amazon, obviously, but the plan is to incrementally broaden the set of white-listed SWFs, so we should get more and more actual usage.
@YABE, Amr, and Sam: Flash is a huge platform that was developed over the course of more than two decades. Creating a drop-in replacement from scratch and only releasing it once every single SWF works, while probably possible, wouldn't be wise, as it would delay the point in time where users start benefiting from the work we do. Instead, we opted for an approach where we target specific SWFs or types of content first to cover as many actual uses of Flash as we can in a certain time frame, extending that list continually.
You can't really get low latency with HLS or DASH without blowing your bitrate budget by reducing your chunk size, constantly starting small files from scratch. WebRTC is still mostly a pipe dream.
Now if someone would implement RTMP or something equivalent in something fancier and less attack-vectory, that would be glorious.
My home is not grid connected so I'm very aware of power usage. h.264 video in something like VLC uses almost no CPU and is very battery friendly. Flash video taxes the CPU more highly and consumes my batteries an order of magnitude faster.
This is a major problem for me with BBC iPlayer: perhaps this project gives me a route towards a solution?
Without the magic of canvas , Javascript do nothing. Remember the first age of Silverlight when in it enfancy was a canvas made by Microsoft with javascript to create beautiful effects.
What is more difficult to understand is how a team composed by two brothers can create a product like fayde and not Microsoft focusing only on HTLM5 with the DOM and all the default and implementations you have to hide with plethora Javascript Library?
Thx as always Scott!!!!
I loved Silverlight because most of my day jobs were doing LOB apps and as anyone in the business knows, it's never, "heres the data, it'll always look like this, put it in a grid or in fields on this page." Its madness and requires a ton of flexibility and a solid language behind it. I could do it with Webforms, SL made it easy. Doing it with JS frameworks/HTML5/CSS took ages longer and forced me to start saying, "Its going to take too long and I won't look exactly like you want."
Now I use WPF and it is wonderful, I never have to say no or compromise, more often I can over deliver in less time. Like the user above, if the day comes that I can't write real C# anymore or something similar, I'm out. I'll manage or teach or something but I love programming too much to ruin it with this stuff.
The web needs to be reborn instead of endlessly hacking together an old technology into frameworks we have to hope never get abandoned, that are just emulating what we already have in C#.
The language appears similar to C#, however you still have to deal with HTML/CSS.
The web needs some alternative languages and not ones built on top of Javascript.
Adobe Flas Pro ( the authoring tool) has already moved in to publishing for canvas and webgl. The implementation details would have to be standardized so that it can offer a consistent run time just like it did when Adobe was the sole distributor of the run time. TOO MANY THINGS NEED TO ALIGN HERE
It can never replace Silverlight. The speed of SL is unmatched. We still develop OOB apps and they are working super. Of course it is not for simple web pages. You should use web for that. For example, office like applications build in html web just sucks. Programming it and using it. Yes I did years active web dev too. I just tolerate JS and try not to use it. Which JS framework is now in fashion? Spine? Meteor? SL just works.
Hope the guy who diverted the resources to Windows RT is working for Oracle now I hope and mess stuff up there.
Yes Javascript has won not as a replacement of Silverlight but as a solution for everything. If .net wants to compete the solution will be to open source Silverlight / WPF E so it can run freely everywhere. We might even get a new browser that can run .net and javascript ;)
the Windows XP computers, do the identical on any Windows Vista machines.
Share your phone's Internet connection together with your other Wi-Fi enabled devices with
your great Android tethering apps on your phone.
A Wi - Fi phone is merely a phone which uses Wi - Fi for phone calls
as opposed to a cellular service. Top Five Wireless Printers - Wireless printers will be the ticket to your cable-free, hassle-free, and efficiently fast
strategy for printing documents. best wifi extender amazon extender vs
repeater What this implies is that a dynamic Wifi connection is fundamental to i - Pad use as well as
any i - Pad Wifi problems brings use with a hault.
Cooled or Uncooled - Most infrared cameras fall under the "uncooled" category, which means that camera just isn't equipped with just about any onboard cooling
mechanism. waterproof cameras dslr cameras inexpensive The Fuji Fine Pix F440 packs
slightly more zoom than any other cameras in the class.
To capture the daily and occasional moments of life one wants a best compact camera, whether any
memorable moment in their holidays or capture any memorable event of life.
These two-in-one cameras, as earlier mentioned,
not only cut the variety of cameras needed, but also divide the amount of domes needed for that system in half.
My 2009 Flash app is still serving up content and still looks cool. My 1996 desktop app looks dated but runs faster and better then ever!
My 2012 web app has been re-written, re-vamped and revised a dozen times over by a half dozen different teams. We've all failed to deliver with this forever failing Dinosaur technology.
When will the HTML straw man be set on fire?
First, thanks for the post!
CsHtml5 is a nice project, but is not open-source and is a commercial project just like Xamarin is.
The idea of porting C#+XAML to HTML5+CSS3+JS is not new. We were praying for it since Silverlight's death. But MS decided to kill XAML and C# and put JS in the front. C# (and especially XAML), even with the opening of .NET, is far from being a cross-platform technology. Unless you're willing to pay a fortune for Xamarin or the like.
Anyhow CsHtml5 is half-way thru, and doesn't really give a chance for people to contribute. I hope Microsoft acquires it or a similar project early on and makes it all open-source. Right-now the only trade-offs for Silverlight are either far for being complete or total rip-offs.
With CsHtml5+Apache Cordova, it could now really be easy to create fully cross-platform native apps with C#-XAML.
From the post itself and the way it's presented, doesn't look like this is really ever going to happen. Anybody who invested his soul in Silverlight (and RIA! oh RIA! does anybody even remember this name? who'd believe this was a diamond only a couple of years ago!), should get together and put effort in JS and other universal languages besides C#.
I hope MS will endorse back CsXaml again, and give a proper compensation for all the Silverlight victims.
Comments are closed.
http://cshtml5.com
You can do *anything* with JavaScript... it's any wonder why MSFT doesn't officially port .NET to it like CSHTML5 (and JSIL, which you mentioned, it's based off of) is attempting to do. It should have been done YEARSSSSSSSSS ago after Mix'11. :P When MSFT cancelled Silverlight, THIS is what should have been announced!