Building a Website #Day14
Key Takeaways
Builds a 3D, VR, 360 image of the SFJAZZ center using the VRView Library
Full Transcript
well this is awkward so far death diary has been exclusively Paul and now I'm here I kind of snuck into the series because I actually built something on the Chrome death Summit website uh and I wanted to show you what I did because I think it's really exciting so the last few weeks I've been playing around with VR and web VR a little bit I'm just dabbling I'm you know just trying things out um and Paul and I thought it would be a really cool opportunity to build like a 360 image of the SF Jazz Center into the Chrome def website for that people if they are not able to join us live tomorrow they could actually at least see what the venue looks like and have get more a feel of the space that is available to us and that's exactly what I did so uh if you go to the Chrome def website developer.chrome.com/apps same website that Paul built but you have this tiny cardboard button and if you click it we load the 360 view of the SF Jazz Center on a desktop with just normal desktop you can just use your mouse to pan around and get a feel for what the surroundings look like if you're on your phone you can actually just hold the phone in your hand and move around uh and have this as a like a magic window into a different location um you'll also have a cardboard button that if you have a cardboard you can put your phone inside it and actually move your head around to actually feel even more like you're there and if you have a proper VR device you can actually use that to uh get into the location use a proper like an ulous Rift or the HZ Vive or whatever you have um and use that to actually take a look inside so as I said this is sadly just a stereoscope just a 3D 360 image so many acronyms 360 image it is not a stereoscopic image so the perception of depth won't actually be real but you will have like this is basically a big 3D sphere with a texture on the inside that you can look around in to give you at least the the feel of you looking around but not actually a feel of of depth so how do I do this how this this is actually a good example of how to do Progressive enhancement with web VR because if you don't have anything it still works with ma with mouse and panning and you can just use your mouse L on it's already a pretty good experience so let's dive into the code a little bit um mostly I'm working with VR view which is a great library that a colleague of mine wrote which uses the VR polyfill and the VR boiler plate so VR polyfill basically polyfills the web VR API for your browser while the VR boiler plate does the progressive enhancement story to go from just a canvas where you can pan around to cardboard to um to actual VR devices so if you go into the component section where Paul has written different things like the video handle that does the fading the moving in and out of Big Picture Mode to small picture mode for the video I wrote a new VR component and it's actually mostly a lot of animation and class JavaScript but mostly what it does is it checks if you are on the de Summit location sub page and if so it will fade in the button or rather if you're not on the def Summit location sub page it will just not do anything thing and then we hijack the m to inject our little button and do Transitions and all of these kind of things is not not rocket science right here and the interesting thing is basically the two lines of the onclick Handler if you click on that button we will hide the button because it needs to go out the way and also we will load a script so that means we will load a script on click this is usually not recommended because it will take it mean that if you click it there will be especially if you've never loaded this script it will take a lot of time until action takes place however I thought that it's probably not going to be every single visitor on the website is that is going to go into the VR experience so both forcing the data onto the user and loading it ahead of time just because didn't seem like a good idea so I just wanted to load it on demand and the webvr script is again mostly about hijacking so this is where uh I use VR view the library and I hijack the master to inject a new iframe uh where inside I'm going to have the canvas with the 360 image and everything this is all the things that webvr does for me um and it's basically one call so what I'm doing is uh I'm saying create a new player for me webvr please uh put it into the VR view ID element and use this image that we have and that's basically all I have to do and with this code it already worked and after that I uh took a little bit a closer look into web y because the amount of data we were transferring was was quite big and it turns out that web VR actually bundled the chakra player uh which makes sense because it also has support for playing videos in web VR or in a VR space um and chakra player is a module that basically does adaptive streaming it Tunes down the quality depending on how how much bandwidth you have at your disposal but you're never going to play video here so so delivering that code to the user is just going to waste so I'm basically vendoring the entire VR view into third party our third party folder here and I commented out lot of requires that were in there and just recompiled the entire thing and shrunk the code down so I think at this point when gzip we're now delivering uh 100 kilobytes of code and 250 kilobytes of image data which I think is it's still a lot of data but it's acceptable most of the time on mobile um and it will load quick enough most of the time other than that it's very basic code but I did find a nice pattern which is creating functions that create promises for both request animation frame and transition end so trans calling transition end promise on an element will give you a promise that resolves when transition end is fired on that element and it allows you to just do these chains uh chains as in Chains you chain promises together so I Call Transition end promise on the M head and when is when that is done I append a child I do a double graph and then I do again a class adaptation and do Transition and promise again so this is basically how I can just more or less declaratively uh do animation sequences without using the actual web animation API which is somewhat of a nice work on it's not as powerful but um it makes stuff a little more readable than having multiple levels of indentations because you to double w and all these kind of things uh if you like this let me know if you have questions let me also know I am at Sur on Twitter uh if you want to join us tomorrow at the sfj center in person come by it's going to be great if you can't use the features on the Chrome Summit website to get notifications when we're going to go live everything is going to be live streamed subscribe also to this YouTube channel because we have more great things here that are going to come out regularly so um thank you for watching and hopefully see you [Music] tomorrow a
Original Description
The Chrome Developer Summit is upon us! Surma has made some cool last minute additions to the website - in Developer Diary #14 he shows you how he built in a 3D, VR, 360 image of the SFJAZZ center.
VRView Library: https://github.com/googlevr/vrview
See the source code: https://goo.gl/6Dwwrs
Subscribe to the Chrome Developers Channel: http://goo.gl/LLLNvf
Check out the playlist: https://goo.gl/cbQTWK
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Chrome for Developers · Chrome for Developers · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Polymer Performance Patterns (The Polymer Summit 2015)
Chrome for Developers
Polymer Power Tools (The Polymer Summit 2015)
Chrome for Developers
Chrome Dev Summit 2014 – Chrome Case Studies
Chrome for Developers
Web Directions Code 2015 round up
Chrome for Developers
Maintainable Code - HTTP203
Chrome for Developers
iron-ajax… wat?! -- Polycasts #26
Chrome for Developers
The Guardian - Supercharged
Chrome for Developers
ES2015 (next version of JavaScript), Totally Tooling Tips (S2 Ep1)
Chrome for Developers
#AskPolymer: Rob answers all the questions ever -- Polycasts #27
Chrome for Developers
The Future of JavaScript - HTTP203
Chrome for Developers
Data Binding 101 -- Polycasts #28
Chrome for Developers
The Guardian part 2 - Supercharged
Chrome for Developers
The Future of Web Audio: with Chris Wilson and Chris Lowis
Chrome for Developers
Chrome 46: New motion-path animations, client hints and service worker improvements
Chrome for Developers
Sublime Snippets, Totally Tooling Tips (S2 Ep2)
Chrome for Developers
#AskPolymer: How do you make the show? -- Polycasts #29
Chrome for Developers
Critical Path CSS, Totally Tooling Tips (S2 Mini Tip #1)
Chrome for Developers
Binding to Objects -- Polycasts #30
Chrome for Developers
Player FM - Supercharged
Chrome for Developers
Where’s the Designer? #AskPolymer -- Polycasts #31
Chrome for Developers
Jake Beats Wikipedia - HTTP203
Chrome for Developers
Supercharged Observers! -- Polycasts #32
Chrome for Developers
Jai's Web blog - Supercharged
Chrome for Developers
Windows Command-line Tooling, Totally Tooling Tips (S2, Ep4)
Chrome for Developers
What about internationalization? #AskPolymer -- Polycasts #33
Chrome for Developers
Developing for Billions (Chrome Dev Summit 2015)
Chrome for Developers
Google+ Performance Improvement Comparison
Chrome for Developers
Deploying HTTPS: The Green Lock and Beyond (Chrome Dev Summit 2015)
Chrome for Developers
Progressive Web Apps (Chrome Dev Summit 2015)
Chrome for Developers
Instant Loading with Service Workers (Chrome Dev Summit 2015)
Chrome for Developers
Increase Engagement with Web Push Notifications (Chrome Dev Summit 2015)
Chrome for Developers
Engaging with the Real World: Web Bluetooth and Physical Web (Chrome Dev Summit 2015)
Chrome for Developers
Asking for Permission: respectful, opinionated UI (Chrome Dev Summit 2015)
Chrome for Developers
Polymer - State of the Union (Chrome Dev Summit 2015)
Chrome for Developers
Building Progressive Web Apps with Polymer (Chrome Dev Summit 2015)
Chrome for Developers
Introduction to RAIL (Chrome Dev Summit 2015)
Chrome for Developers
DevTools in 2015: Authoring to the max (Chrome Dev Summit 2015)
Chrome for Developers
RAIL in the real world (Chrome Dev Summit 2015)
Chrome for Developers
#ChromeDevSummit talks are up - W00T! -- Polycast #34
Chrome for Developers
V8 Performance from the Driver's Seat (Chrome Dev Summit 2015)
Chrome for Developers
Quantify and improve real-world RAIL (Chrome Dev Summit 2015)
Chrome for Developers
Owning your performance: RAIL (Chrome Dev Summit 2015)
Chrome for Developers
HTTP/2 101 (Chrome Dev Summit 2015)
Chrome for Developers
Leadership Panel (Chrome Dev Summit 2015)
Chrome for Developers
Build Processes, Totally Tooling Tips (S2, Ep 5)
Chrome for Developers
Accessibility (Chrome Dev Summit 2015)
Chrome for Developers
Binding to Arrays -- Polycasts #35
Chrome for Developers
HTTP2 - HTTP203
Chrome for Developers
Chrome 47: Splash Screens, requestIdleCallback and better desktop notifications (New in Chrome)
Chrome for Developers
Call For Submissions - Supercharged
Chrome for Developers
Cross Device Testing, Totally Tooling Tips (S2 Ep6)
Chrome for Developers
Testing AJAX with Web Component Tester -- Polycasts #37
Chrome for Developers
Slack: Extended Xmas Special - Supercharged
Chrome for Developers
Browser testing with Travis & Sauce Labs -- Polycasts #38
Chrome for Developers
Optimize for production with Vulcanize -- Polycasts #39
Chrome for Developers
Highlights from Chrome Dev Summit 2015
Chrome for Developers
Chrome 48: Custom buttons in notifications, DevTools Security panel, and Presentation mode
Chrome for Developers
Crisper: Protecting your Polymer app with CSP -- Polycasts #40
Chrome for Developers
How do I use Sass with Polymer? #AskPolymer -- Polycasts #41
Chrome for Developers
Colors – DevTools Tonight #0 (Pilot)
Chrome for Developers
More on: Frontend Performance
View skill →Related Reads
📰
📰
📰
📰
How AI Is Changing YouTube Forever
Medium · AI
China’s AI models have Trump’s AI world at war with itself
MIT Technology Review
Getting Started with AI Evals — Part 2: The AI Benchmark Maze: How We Actually Test Modern Models
Medium · Data Science
Getting Started with AI Evals — Part 2: The AI Benchmark Maze: How We Actually Test Modern Models
Medium · Programming
🎓
Tutor Explanation
DeepCamp AI