HTML5
Introducing Video Player Sample
0
Have you ever wanted a fun and beautiful way to publish videos on your own site like the new 60 Minutes or RedBull.tv apps from the Chrome Web Store? I’m excited to announce the release of The Video Player Sample! The Video Player Sample is an open source video player web app built using the same architecture as the 60 Minutes and RedBull.tv apps. It can be customized, extended, or just used out of the box and populated with your own content.
How it works
When a user opens the Video Player Sample web app, they can choose to watch a single video or create a playlist of videos/episodes from a list that they have uploaded and populated to the app. The Video Player Sample is configured and information about the videos is stored in JSON files (config.json and data.json respectively), both of which are located in the data directory.
Key features
- A beautiful video watching experience, including a full screen view
- Ability to subscribe to shows, watch episodes, create play lists
- Support for multiple video formats depending on what the user’s browser supports (including WebM, Ogg, MP4, and even a Flash fallback)
- A Categories page with an overview of the different shows/categories available in the app
- Notifications of new episodes (when the app is installed via the Chrome Web Store)
- Built in support for sharing to Google+, Twitter and Facebook
- To ensure easy customization, all source files, including the Photoshop PSD’s, are included
How it’s built
The Google Video Application is written for the open web platform using HTML and JavaScript, broadly following the MVC (Model View Controller) pattern and structure.
- It is built using the open source Google Closure JavaScript library
- Compiled with the Closure Compiler
- Distributed through the Chrome Web Store to take advantage of notifications
Browser Support
In addition to working as an app that can be installed through the Chrome Web Store, the Video Player Web App has been tested and works in all of the modern browsers.
Try it out
You can see a demo of the video player in action in the demo app, or by Adding it to Chrome through the Chrome Web Store. To learn more about how the app works, check out the documentation.
You can grab the code from Google Code.
Enjoy!
Cross Posted at: http://google-opensource.blogspot.com/2012/01/introducing-video-player-sample.html
Happy Blue Beanie Day
0Happy Blue Beanie Day from the HTML5 Hipster
Credits: Seth Ladd for the HTML5 Guy idea. Kevin Cornell (via) Zeldman for the Beanie.
Other Formats: SVG Adobe Illustrator PNG
Building A More App-y Web
0Everyone wants “apps” these days, on their phone, their tablets, Apple, has the App Store to sell apps for the Mac. The demand is coming from all over the place, including consumers who have no idea what apps are, to people who are seeing this as a new revenue opportunity (which, it is)! I even heard from one developer who said that his boss came to him all panicked because he got a call from the company’s chairman of the board, wanting to know what their app strategy was. So far, most of the focus has been on apps for mobile devices, tablets, but thankfully it’s really starting to take off on the web, and we’re seeing more web apps appearing.
One piece of the puzzle that hasn’t really solidified yet is what defines a web app, and how does it differ from a web site? Are app like experiences on the web part of a website, or are they web apps? What about web sites that provide the same functionality as an app, but looks like a web site?
Is it a web site, or a web app?
TripIt is a great example, it’s concept is absolutely an app, it helps me to coordinate my travel plans into a single place where I can easily organize my trips into a single online experience. Here’s where it gets confusing, compare their web application to their tablet application. I can do exactly the same sets of things, but one looks like an application, and one looks like a website. They both let me do the same tasks, but they provide very different experiences to complete those tasks. So what is the TripIt web app, is it a site or an app?

How do we define a web app then?
A web application is an application utilizing web and [web] browser technologies to accomplish one or more tasks over a network, typically through a [web] browser.
That answer is almost as good as saying “because it’s not orange” to the question why is the sky blue.
It can’t be a single criteria
Single criteria definitions don’t work for me either. Can we say something is an app because of a single property? For example, creation vs. consumption, or architecture. Add the diversity of web apps to the mix, and I think we hit a wall when it comes to defining web apps with a single criterion.
A web app checklist
The diversity of apps makes it impossible to have a single go/no-go checklist that we can use to define apps. A criterion for one app may be completely inappropriate for another app. Instead, I think we need to judge apps based on reaching a particular bar of ‘app-y-ness’.
- Does the app have a tight focus around a single point or purpose?
- Is the app self-contained, keeping me within the app to complete my task?
- Does the app encourage interaction, engagement and completion of tasks?
- Does the app look beaultiful and have a rich user experience?
- Does the app have an action oriented interface that uses similar paradigms to native applications, for example dialogs, buttons instead of links and new pages?
- Is there at least a functional offline experience?
- Does the app take advantage of the capabilities of the device, like geolocation or device motion?
- Are traditional websites elements and links are hidden from view?
- Is the app architected to uses a primarily client side architecture model?
Now, let’s look at TripIt’s web “app” vs. their tablet app:
| Web “app” | Tablet app | |
| Tight focus | Yes | Yes |
| Self-contained | Yes | Yes |
| Encourage interaction, engagement & task completion | Yes | Yes |
| Beautiful & rich user experience | Maybe | Yes |
| Action oriented with native design paradigms | No | Yes |
| Offline | No | Yes |
| Native capabilities | No | No |
| Traditional website elements hidden? | No | Yes |
| Client side architecture | No | Yes |
By this criteria, even though their web site is super functional, I can get the things done that I want and has some of the qualities of an app, it clearly could be more app-y. Could TripIt build the same experience as a web app? Absolutely! Heck, it might even be less work because then they could reuse a lot of their design and UI components across the web and tablet versions.
But who really cares?
I do! With more and more people demanding apps, I think we’re missing a huge opportunity to provide our users with web applications that are better, faster, and more fun to use than their mobile or native counterparts. People will pay for mobile and native applications, but we have given them very few web apps that are worth their money. We need to step up and change that, let’s build a more app-y web.
Canadian Chrome Web Store Incentives
0
The last month has been really exciting for the Chrome Web Store. Not only did we launch the new (and very much improved user experience), we also launch internationally. The Chrome Web Store is available in lots more countries, but one in particular is close to my heart – Canada. In fact, I was up in Canada last week for a hack-a-thon and to meet with some great companies to talk about the Chrome Web Store.
With any newly launched product, there are lots of great opportunities for people to jump on board early, and if you’re a Web Developer in Canada, this is certainly one of them. On Thursday, we announced a special program for Canadian Web Developers. We want to see more Canadian Web Developers featured with apps that will resonate with Canadians. That’s why we’re offering a great incentive for submitting your apps! Our panel of experts will review the apps that you submit and for each app that meets the criteria, you will receive a $200 Amazon gift certificate – not to mention exposure to more than 200 million Chrome users around the world.

You’ve got until December 31, 2011 at midnight (PST) to get your app submitted to the Chrome Web Store and fill out the submission form. You’ve got just about 2 months to get your app built and submitted. Be sure to read the complete rules and regulations at here.
To learn more visit The Chrome Web Store Canadian Web Developer Incentive Program site, including full regulations, and how to submit your app!
If you’re looking for resources to get you started, check out some of these links:
- Chrome Web Store Developer Guides: http://code.google.com/chrome/webstore/docs/index.html. These are the developer guides and tutorials for getting started submitting web apps to the Chrome Web Store.
- Tutorial: Getting Started with the Chrome Web Store: http://code.google.com/chrome/webstore/docs/get_started_simple.html. A super easy tutorial that will get your app into the store, without any custom features.
- Background: Extending Your App’s Life: http://code.google.com/chrome/apps/docs/background.html. This details how to add the background features to your app, using this, you can query for information, and then use notifications to alert the user, even when they’re not in/on your site.
- Using the Notifications API: http://www.html5rocks.com/en/tutorials/notifications/quick/ is a tutorial on how to use the notifications API available in Chrome and through the Chrome Web Store.
- Identifying the User: http://code.google.com/chrome/webstore/docs/identify_user.html is a good overview of OpenID and at the bottom under resources are a couple links to tutorials on implementing OpenID.
- AppMator: http://appmator.appspot.com is a tool that will automate the basic process of getting your app into the store. Sadly, it won’t handle the background page stuff, but does do the basics
- Application Cache: http://www.webdirections.org/blog/get-offline/ and http://www.html5rocks.com/en/tutorials/#appcache both provide great resources that you’ll find quite helpful
- Web Storage – LocalStorage and SessionStorage: are both widely implemented and allow for storing of name/value pairs, not good for binary data, but useful for things like lessons completed or topics of interest. The other great way we’ve seen this used is as a temporary cache until the client can connect to the server to update things. http://www.html5rocks.com/en/features/storage
Good luck!
PEte
HTML5 Hack-A-Thon Coming To A City Near You
1
Well, hopefully it’ll be near you – if not, let me know in the comments where you are so we can try to get some more of these events set up!
Google is holding a few developer focused hack-a-thons around the US and would like to invite you to attend. At these events, we will be covering some of the latest and greatest features of HTML5, Chrome Web Store and In-App Payments. You will learn about the end to end flow of building a web app, distributing the app and monetizing it using these APIs. You will also have the opportunity to work hands on with the APIs and ask our experts (including me) questions. I’ll be helping out in Chicago and Mountain View.
For more information on the events and to register, please check out the location specific links below:
New York – 8/1 – http://www.eventbrite.com/event/1892631913
Chicago – 8/3 – http://www.eventbrite.com/event/1910102167
Seattle – 8/8 – http://www.eventbrite.com/event/1910138275
Mountain View – 8/11 – http://www.eventbrite.com/event/1910202467
* Image http://www.flickr.com/photos/dmitry-baranovskiy/2378867408/
Showing & Hiding Panels with HTML and CSS
2
I’ve always loved web apps that use little panels that animate in from the sides as a way to show and hide content, settings, or other components of a web page. We used them a couple of times in Tweeter Fall, so I figured I’d share my way of doing them. I wanted to try doing this without any libraries to start, using only HTML5, CSS3 and as little JavaScript as possible, which will work for most browsers, but not all. Once we get it working with the latest stuff, I’ll go back and make the necessary modifications to get it to work across all browsers.
I’m using a slightly modified version of Eric Meyer’s CSS reset to ensure that everything is ready to go, you can use that or other ones as you see fit.
Let’s get started!
First, let’s create the panel where everything will live
<div class="left-panel"> </div>
and we need to apply a bit of CSS. Typically when I start working on something like this, I’ll use super ugly colors to make sure that the stuff that I’m working on sticks out, so in this case, I’m going for a nice bright red.
#left-panel {
width: 300px;
height: 400px;
border: 3px solid red;
background-color: #fcc;
}
Positioning The Panel
Great, we’ve not got our panel, though it’s not in the right place, but at least it’s on screen. Next, let’s move it to it’s default position, so that it’s minimized. To do that, I’m going to set the position to fixed – I want it so that it’s always on screen. Then, we need to move the left side of the panel into the negative space, and move the panel down the screen.
#left-panel {
width: 300px;
height: 400px;
border: 5px solid red;
background-color: #fcc;
position: fixed;
top: 150px;
left: -275px;
}
Making the panel appear
To get the panel to be fully visible, we’re going to add both a hover pseudo-class as well as a show class. The pseudo-class will move it out just a bit, to add some realism and a clear indication that the panel has more to show.
#left-panel:hover {
left: -250px;
}
#left-panel.show {
left: 0px;
}
Adding controls to show & hide the panel
You could simply show the panel on any hover, but that always gets a little annoying to me, especially when I’m moving my mouse around quite a bit, so I’d rather not do that. Now we need to add the logic that will show and hide the panel. I’m going to use a hyperlink as the main item, and a little JavaScript to toggle the show class. The > will come in handy a bit later.
<div id="left-panel"> <a href="#" onclick="showLeftPanel();" class="controller">></a> </div>
The CSS for the hyperlink is pretty simple, it absolutely positions the hyperlink in the upper right hand corner, and removes the underline from the text.
#left-panel .controller {
position: absolute;
right: 0px;
top: 0px;
text-decoration: none;
}
Hooking everything up
Finally, we need the JavaScript to toggle the CSS class. I’m using a new property off element called callList that gives me similar functionality to a lot of libraries for modifying classes on elements. classList provides the ability to add, remove or toggle classes on elements.
<script type="text/javascript">
function showLeftPanel() {
var elem = document.getElementById("left-panel");
elem.classList.toggle("show");
}
</script>
Now, when we click on the >, the panel becomes visible, and clicking on it again, makes it disappear, perfect! The panel isn’t exactly beautiful yet, and it doesn’t take advantage of any of the cool CSS3 stuff yet, so let’s add a bit of that.
Adding a bit of style
First, we’ll add some rounded corners to the top right, and bottom right, and a little bit of spacing inside the panel with a 5px padding along all the edges. Next, I’ll add the transtion properties. The first, -wekit-transition specifies that all properties that change (beyond what’s indicated in #left-panel), they’ll appear over 0.5 seconds, and will use the ease-in-out transition. In a bit, we’ll need to add the transitions for other browsers that support it – but we’re going to get it working in Chrome first.
#left-panel {
width: 300px;
height: 400px;
border: 5px solid red;
background-color: #fcc;
position: fixed;
top: 150px;
left: -275px;
border-radius: 0 1em 1em 0;
padding: 5px;
-webkit-transition: all 0.5s ease-in-out;
}
I also need to make a few other modifications to a couple of the other classes. I’ve changed the left on #left-panel.show to -5px. That hides the border on the left, and ensures the 5px padding on the left doesn’t look too odd. I could have modified the border to only display on three sides, but it kind of felt like more work to me.
#left-panel.show {
left: -5px;
}
Add hinting to help the user
The other thing that I want to do is make a few changes to the open/close hyperlink. Because of the rounded corners, we need to move it in a bit, but I’m also going to add transitions to it as well.
#left-panel a.controller {
position: absolute;
right: 5px;
top: 5px;
text-decoration: none;
-webkit-transition: all 0.5s ease-in-out;
}
So why add the transitions? When the panel is closed, we’re using a > which renders like an arrow pointing to the right, to indicate the panel can be closed, we want the arrow to point to the left, so I used a transform and rotated the character by 180 degrees, and suddenly my > is a <!
#left-panel.show a.controller {
-webkit-transform: rotate(180deg);
}
Our first working version
Alright, so here’s the final code that works in Chrome, with some nicer colors:
The HTML
<div id="left-panel"> <a href="#" onclick="showLeftPanel();" class="controller">></a> </div>
The CSS
#left-panel {
width: 300px;
height: 400px;
border: 5px solid #555;
background-color: #ccc;
position: fixed;
top: 150px;
left: -275px;
border-radius: 0 1em 1em 0;
padding: 5px;
-webkit-transition: all 0.5s ease-in-out;
}
#left-panel:hover {
left: -250px;
}
#left-panel.show {
left: -5px;
}
#left-panel a.controller {
position: absolute;
right: 5px;
top: 5px;
text-decoration: none;
-webkit-transition: all 0.5s ease-in-out;
color: black;
font-weight: bold;
}
#left-panel.show a.controller {
-webkit-transform: rotate(180deg);
}
And finally, the JavaScript
<script type="text/javascript">
function showLeftPanel() {
var elem = document.getElementById("left-panel");
elem.classList.toggle("show");
}
</script>
But what about other browsers?
To get this working in other browsers, we need to change our CSS a bit to add other vendor prefixed items, and we’ll need to make some changes to our JavaScript as well.
Safari
Safari doesn’t support classList’s yet, so we need to modify our JavaScript here. The absolute easiest way to make this change would be to use jQuery’s toggle function, but I want to do this without any libraries. That means we’ll have to do some feature detection to see if elem.classList is supported, if it is, we’ll use that, otherwise we’ll manually add or remove the show class.
<script type="text/javascript">
function showLeftPanel() {
var elem = document.getElementById("left-panel");
if (elem.classList) {
elem.classList.toggle("show");
} else {
var classes = elem.className;
if (classes.indexOf("show") >= 0) {
elem.className = classes.replace("show", "");
} else {
elem.className = classes + " show";
}
console.log(elem.className);
}
}
</script>
That’s all we need for Safari to work!
Firefox and Opera
Firefox 3.6+ and Opera 11.5+ both support classList, and previous versions will fall back to the manual method, so our JavaScript is good to go. But, the -webkit- vendor prefixed stuff needs a little love and thankfully it’s pretty easy!
In #left-panel and #left-panel a.controller add:
-moz-transition: all 0.5s ease-in-out; -o-transition: all 0.5s ease-in-out;
In #left-panel.show a.controller add:
-moz-transform: rotate(180deg); -o-transform: rotate(180deg);
Internet Explorer
Unfortunately, Internet Explorer (9 or the Platform Previews for 10), don’t have support for transtions yet, which mean that our panels just appear and disappear, but that’s not an awful experience, it’s just not ideal. In fact, the experience for Internet Explorer 7, 8 and 9 is identical except IE9 does have rounded corners. Just in case they add support for transitions in the future, I added the -ms- vendor prefix already.
Summary
There you go – you’ve not got a simple panel that can be displayed by the simple click of a link, and gets out of the way when not needed. It works in IE7/8/9, Chrome, Firefox, Opera and Safari and I suspect it will work in IE6, though I didn’t test that.
Give it a try at http://petelepage.com/scratch/slider-panel/
GoDaddy and AppCache Manifest Files
1In trying to add HTML5 Application Cache support to one of my web apps today, I hit a few little snags with my hoster (GoDaddy with a Shared Deluxe Windows account) and wanted to share as I’m sure other people will run into the same thing.
Each time I uploaded my web.config file, I kept getting 500 server errors that weren’t very helpful. As it turns out, the extension .manifest is already taken by the mime-type application/x-ms-manifest, and when I tried to override that, IIS got kind of angry, and served the 500 Server error. I wasn’t quite sure what was happening, but was able to figure it out by reverting to my original web.config file, and requesting the appcache.manifest file that I had already uploaded. Sure enough, using the network tab in the Chrome DevTools, I saw it was being served back with the wrong mime type.
To resolve the issue, I added a new static file handler for .appcache files in the system.web -> httpHandlers section. If you don’t do this, IIS doesn’t know about the file type and it won’t serve unknown file types at all. Then in system.webServer -> staticContent, I added a mimeMap extension for .appcache files with the mimetype of text/cache-manifest. After uploading the web.config file again, I retried my request, and sure enough, everything worked perfectly!
My final web.config now looks like…
<configuration>
<system.web>
...
<httpHandlers>
...
<add verb="GET,HEAD" path="*.appcache"
type="System.Web.StaticFileHandler" />
</httpHandlers>
</system.web>
...
<system.webServer>
...
<staticContent>
<mimeMap fileExtension=".appcache"
mimeType="text/cache-manifest" />
...
</staticContent>
...
</system.webServer>
...
</config>
Check out this tutorial on Application Cache at HTML5Rocks.com. Also, you can find a full list of the default mime types provided by GoDaddy’s IIS servers here.
[Update 6/30/11 @ 1:53pm] @Paul_Irish pointed out that the recommended extension is .appcache specifically to avoid the unregistered Microsoft extension, and referred to a bug on HTML5.org. So there you have it!





