字幕组成品列表(Beta)
  • 写在前面
  • Android 平台
    • Game On! 游戏开发系列 - 031
      • Pie Noon - 1503060393
      • The Death of Base Game Activity - 1504030543
      • Surviving OpenGL Context Loss - 1504030546
      • WebP for Game Devs - 1504030547
      • Saved Games In-Depth (Part 1) - 1504070556
      • Saved Games In-Depth (Part 2) - 1504030548
      • Smaller Flipbook Textures with CRABBY - 1504030544
      • Google Tag Manager - 1504030545
      • Flatbuffers - 1505050794
      • Achievement Point Pointers - 1505050796
      • Frequency Scaling - 1505050797
      • Meet the Management APIs - 1501140367
      • Y U Ship Broken Games - 1505050795
    • Android 性能优化 - 088
      • Garbage Collection in Android - 1503170425
      • Performance Cost of Memory Leaks - 1503170424
      • Rendering Performance 101 - 1501130351
      • Understanding Overdraw - 1501130352
      • Understanding VSYNC - 1501130353
      • Tool - Profile GPU Rendering - 1501130354
      • Why 60fps? - 1501130355
      • Android UI and the GPU - 1501130356
      • Invalidations, Layouts, and Performance - 1501130357
      • Overdraw, Cliprect, QuickReject - 1501130358
      • Tool - Memory Monitor - 1501130363
      • Battery Performance 101 - 1501130364
      • Understanding Battery Drain on Android - 1501130365
      • Battery Drain and WakeLocks - 1501130366
      • Memory Performance 101 - 1504170661
    • I/O 2014 Android 开发专题 - 089
      • Activity Transitions - 1504020505
      • Building Apps For Android TV - 1504020520
      • Building great Android media experiences - 1504020510
      • Building a quality app from start to finish - 1504020515
      • App Indexing API - 1504020507
      • What's new in WebView - 1504010484
      • Bluetooth Low Energy - 1504010486
      • Building impressive Android media experiences - 1504010493
      • The next Generation of Authentication - 1504020497
      • Don't Alpha That Pixel! - 1504020523
      • NFC + HCE Your phone in an interactive world - 1504020509
      • Demystifying encodes and decodes of WebM - 1504020521
      • Google Cloud Messaging - 1504020524
      • Getting your Game on the Big Screen - 1504020518
      • I hear you like realtime memes - 1504020511
      • Offerize your App - 1504020506
      • Using the Android Job Scheduler - 1504020504
      • From Holo to Material - 1504020526
      • Under the Hood of Android Auto - 1504020501
      • Isolation for Android App Developers - 1504020498
      • Android Work - 1504010496
      • ExoPlayer: Adaptive video streaming on Android - 1504010489
      • Sample rates and resampling: Why can't we all just agree? - 1504010488
      • Drive Android API - 1504010485
    • Android Studio - 004
      • Layout Editor (Ep 3, Android Studio) - 1503290479
      • Introducing Gradle (Ep 2, Android Studio) - 1503170426
    • I/O 2014 Android 分发主题 - 091
      • Introduction to Google Play - 1504030534
      • Google Play: building your user community - 1504030535
      • Optimizing Apps for Education - 1504030536
      • Succeeding in Education Technology - 1504030530
      • Subscriptions Made Easy with Google Play - 1504030531
      • The world is your playground - go global with Google - 1504030533
      • Maximizing discoverability on Google Play - 1504030538
    • Android Auto - 003
      • Introduction to Android Auto - 1504130615
      • Android Auto Messaging - 1504130617
      • Android Auto Audio - 1504130616
    • Android Wear - 006
      • Designing for Android Wear - 1503210448
      • How We Customized Google Apps for Android Wear - 1503210450
      • Fullscreen apps for Android Wear - 1503210445
      • New Notification Features for Android Wear - 1503210446
      • Building Cloud-powered wearable Apps - 1503210449
      • An Introduction to Android Wear - 1503190435
      • Google I/O 2014 - Android Wear: The developer's perspective - 1503210442
      • Devoxx 2014 Interviews: Android Wear - 1503210440
      • DevBytes: Watch Faces for Android Wear - 1503210439
    • Android TV - 005
      • Using the Leanback library - 1504080588
      • Beach Buggy Racing Multiplayer with Nearby Connections (Play Services) - 1503060387
    • Android for Work - 106
      • Android for Work for Developers - 1503060390
      • App Configurations, Testing and Launchers - 1504110590
    • IO Bytes 2014 - Android - 066
      • Chrome Apps on Android and iOS - 1501080014
      • Perf Primer CPU, GPU and your Android game - 1501080017
  • Chrome 平台
    • IO Bytes 2014 - Chrome and Web - 067
      • Using the PageSpeed API - 1505070815
      • Fabulous Forms for the multi-device web - 1505070816
      • Testing multi-screen web pages - 1505070817
      • Responsive images today - 1505070819
      • Web Performance Testing at YouTube - 1505070828
      • Building sites for the multi-device web - 1505070820
      • Deep dive: Google Cloud Messaging for Chrome - 1505070827
  • Google 创业者资源
    • Coffee with a Googler - 012
      • Chat with Allen Huang of AndroidTV - 1503040384
      • Chat with Fred Chung about developer advocacy - 1503070395
      • Google Fit platform with Michelle Haq - 1503210443
      • Android Auto Product Manager Andrew Brenner - 1501120027
      • Chat with Francis Ma about Google Play services - 1501120028
    • Root Access For Startups - 077
      • What we learned building plug-ins for Android, with startup Magnet - 1503230453
      • How to use crowdfunding to your advantage, with startup Hale Devices - 1503280462
      • How to overcome customer objections when selling tech, with startup Guesswork - 1503280458
    • First Things First - 029
      • Getting started with Android: A crash-course in developing for Android - 1504120601
      • How to ask a question: conducting research for your startup - 1504120603
      • MVP Design Hacks: transform your hot idea into a validated prototype - 1504120602
      • Build something people want: Solving real problems - 1504120605
    • How I - 061
      • Use BigQuery to find my most valuable customers - 1504070573
      • Manage beta testing communities using Google Play - 1504070572
      • Use paper wireframing to build native prototypes - 1504070570
      • Used social media and $0 marketing to get 68 million users - 1504070568
      • Prep to fundraise with four questions - 1504070564
      • Validated my idea in 2 days (with no code) - 1504070562
      • Build open platforms on Android - 1504120596
      • Get cheap, automatic analytics for my business using BigQuery - 1504070571
      • Write press releases to get international media coverage - 1504070569
      • Test beta-product features using Google Apps - 1504070563
      • Use URL builder to measure ROI on social media - 1504070561
      • Use events to build DeadSocial's brand - 1504070557
      • Use BigQuery to visualize streaming data - 1503220452
      • Find, screen, and hire developers - 1503120406
      • Drive engagement with social challenges - 1504070558
  • 设计
    • DesignBytes - 017
      • Paper and Ink: The Materials that Matter - 1505050793
  • 云计算
    • DevBytes: Google Cloud Platform - 021
      • Powering the next killer app with the Google Cloud Platform - 1504210672
      • Introduction to Google Cloud Endpoints - 1504210675
      • The Beauty of Scale with Google Cloud Platform - 1504210678
    • Google Cloud Platform - Big Data - 105
      • GDELT & BigQuery: Understand the world - 1502200379
    • Uncategorized - 999
      • Introducing Google Cloud Platform Resources - 1501190370
  • Google 应用开发
    • Launchpad Online - 072
      • The Setup: Creating new apps using Google APIs - 1503190428
      • Listing your files in Google Drive - 1503190429
      • Customizing Google Analytics for your startup - 1503290473
      • The Launchpad Online series - 1503190427
      • Getting started with Google Analytics - 1503290472
      • Accessing Google Maps from a spreadsheet?!? - 1502220381
      • Change the world in 10 lines of code - 1503080398
    • Google Play Services - 054
      • Google Play services 6.1 - 1503290481
      • Google Play Services 7.0 - 1503200437
      • Google Play Services 6.5 - 1501080015
    • 谷歌地图 iOS SDK - 053
      • Maps Live: New Features in the Google Maps Mobile APIs for Android and iOS - 1504300777
    • Google 移动搜索开发 - 055
      • Is your app in the Google index? - 1504120598
      • Get more engaged users with Google Search for Developers - 1503070397
    • DevBytes: Google Cast - 020
      • Google Cast SDK for Android - 1504180666
      • Media Router Framework - Part 1 - Media Router API - 1504180667
      • Overview for Google Cast Receivers - 1504180664
      • Google Cast SDK for iOS - 1504180663
    • Getting Started with the Google Maps SDK for iOS - 035
      • Getting started with the Google Maps SDK for iOS, Part 1 - 1504270757
    • IO Bytes 2014 - Wearables - 070
      • Voice Driven GDK Glassware - 1505280836
    • Route 85 - 078
      • Introducing Route 85 - 1501120022
      • Quick Tip: Don't Default that Switch! - 1501190371
      • OpenInChrome on iOS, Part 1 - 1501120023
      • OpenInChrome on iOS, Part 2 - 1501120024
      • OpenInChrome on iOS, Part 3 - 1501120025
      • OpenInChrome on iOS, Part 4 - 1501120026
    • DevBytes 2014 - 019
      • Web Components - Template - 1505040789
      • Wearable DataLayer API - 1505050792
      • Using srcset for responsive images - 1505050790
      • The picture element for art direction - 1505050791
    • Uncategorized - 999
      • Sun Surveyor brings augmented reality to photographers using Google Maps APIs - 1504200668
      • Snappy travels with the Roads API - 1503060392
      • Easy Maps Apps in Java and Python - 1501140030
  • Google 广告平台
  • Polymer
    • Polycasts - 076
      • The Awesome Power of Auto-Binding Templates -- Polycasts #08 - 1502220382
      • Content Switcheroo with Core-Pages -- Polycasts #09 - 1502200380
      • Core Iconset -- Polycasts #02 - 1505040788
  • Web 平台
    • HTTP 203 - 062
      • Gotchas - 1501140368
      • Font Rendering - 1501080016
    • Web Components - 081
      • DevBytes: Web Components - Overview - 1504250709
  • 宣传视频
    • Uncategorized - 999
      • Google Developers - 1501150369
      • I/O Extended 2014 - Join me - 1502220383
  • Google 各类开发者会议
    • 2014 Chrome 开发者高峰会议 - 009
      • Keynote - Chrome Dev Summit 2014 (Darin Fisher) - 1503120407
      • TLS All the Things! - Security with Performance(Chris Palmer) - 1503140412
      • Let’s build some apps with Polymer!(Rob Dodson) - 1503150415
      • Day One Closing Remarks(Sundar Pichai) - 1503150417
      • Chrome Leadership panel - 1503160422
      • Fundamentals of Mobile Web Development(Matt Gaunt) - 1503150416
    • 2015 游戏开发者大会中 - 039
      • FlatBuffers - 1504150640
      • Games for Google Cast - 1504150637
      • Top 10 Things Android Game Developers Should Know v 3.0 - 1504150643
      • Automate Publishing for Google Play APIs - 1504150639
      • 3 Game Design Mistakes You're Making - 1504150636
      • Android TV - 1504150638
      • How to Go Viral Without Really Trying - 1504150641
    • Devoxx 2014 Interviews - 024
      • What's new in Android 5.0 Lollipop - 1504260740
      • Android Tools - 1504260743
      • BigQuery and user-defined functions - 1504260744
    • IO Bytes 2014 - 065
      • Dart in Google Cloud - 1505070810
      • Big genomic data on Google Cloud Platform - 1505070811
      • Easy International Checkout with Chrome - 1505070802
      • Google developer tools and APIs for iOS - 1503190436
      • Whet your appetite with IO Bytes - 1501080021
    • PlayTime@Shanghai - 095
      • 主题演讲 Chris Yerga - 1504060549
      • 如何成功地开发你的应用 Ellie Powers - 1504060550
      • 在Google上营利 Brahim Elbouchikhi - 1504060551
      • Playtime Shanghai event sizzle reel - 1504070552
    • Project Google I/O 2015 - 098
      • Project Tango Mobile 3D tracking and perception - 1506120857
      • Democratizing Education - 1506120868
      • Improve your Android app’s accessibility - 1506120864
      • Google Cloud Messaging 3.0 - 1506120844
      • Developers connecting the world through Google Play - 1506120862
  • 开源开放技术
    • Compressor Head - 013
      • The Trailer, Season 2 - 1503060385
      • Behind the Scenes - 1503210441
      • Arithmetic Compression (Ep 5, Compressor Head) Google - 1503070394
      • Introducing Compressor Head - 1502120372
      • Episode 1 (Variable Length Codes) - 1502120373
      • Episode 2 (The LZ77 Compression Family) - 1502120374
      • Episode 3 (Markov Chain Compression) - 1502120375
Powered by GitBook
On this page
  • 译者信息
  • 解说词中文版:

Was this helpful?

  1. Android 平台
  2. I/O 2014 Android 开发专题 - 089

I hear you like realtime memes - 1504020511

PreviousGetting your Game on the Big Screen - 1504020518NextOfferize your App - 1504020506

Last updated 5 years ago

Was this helpful?

视频发布时间

2014年6月25日

视频介绍

Learn how to quickly and easily make your app collaborative with the Drive Realtime API. Give your users the power of Google Docs-style realtime collaboration with no server, no sweat.

视频推介语

暂无,待补充。

译者信息

翻译

润稿

终审

原始链接

中文字幕

翻译流水号

加入字幕组

lch

任皓

--

1504020511

解说词中文版:

大家好 我是Brian 基于Google Drive Realtime API的程序开发人员(谷歌云存储平台协作服务应用程序接口)

所有人都喜欢玩梗(meme) 尤其是当他们(如gene相对于基因,meme常见译名为模因,指可以复制进化的文化基因)

得到了一张可爱的猫咪图的时候(此处meme:制作的一个可能爆炸性传播的简单图文或视频,如奶茶妹妹,Duang等)

但并非所有人都擅长想出一个好的meme

也许你有了一张可以用来制作meme的

完美的背景图片 但是你还是需要一点小小的帮助

来想出同样完美的标题文字

那为什么我们不写一个在线协作的meme生成应用

好让你和朋友们一起来meme呢

那么一个在线协作meme编辑器应用该长什么样呢

它看起来可能是这样的

你需要一个框来选择你想用来

做背景的图片 然后我们还需要

有文本框来允许你在顶部 中部和下部

来输入标题文字

由于这是一个通用的meme编辑器应用

我们还希望能够有像Google Docs那样的

多人合作模式

这意味着 当一个用户输入 删除或者编辑

这其中任何一个框里的内容

我们也想要实时地看到

他们做了些什么

那么我们用传统的方式

是怎样构建这个通用meme应用呢

嗯 第一件事就是设计我们的服务器

因为我们要有

多人协作的功能 这个服务器

必须要处理更多负载

每次敲击键盘的时候

我们都会得到一个请求

这意味着大量访问数据库的流量以及大量

对我们应用服务器的请求

就算是我们解决了服务器的问题

我们还必须实现多人协作

这意味着要解决冲突的问题

如果一个用户插入文本然后另一个用户删除文本

我们必须用一种解决方案来使

所有用户最后得到相同的结果

当然我们必须自行处理所有这些琐碎的事

我们还必须处理认证和访问控制

我们必须实现网络模块

然后写一大堆的粘合代码把所有这些整合到一起

当我们处理完这些东西之后

我们才能开始着手去做有趣的那部分

这里我们要提供极佳的用户体验然后构建一个最棒的meme应用

但是我们在这并不是来讨论

怎么通过这种相当困难的途径来做这件事

我们这里要谈论的是如何使用Drive Realtime API来完成它

这东西看起来就像这样

遇到所有的上面的困难的话

我们只需要用Realtime API来替换

你只需要搭建一个伟大的meme应用

搭建你的用户交互界面

专注于如何让你的应用更精彩

它是怎么做到如此简单的呢

嗯 就像是呈现出来的那样 使用Drive Realtime API

构建一个多人协作应用简直易如反掌

你现在构建一个多人协作应用相当简单

而且比你构建一个传统意义上的非多人协作应用

要花费更少的工夫

这是因为你不需要服务端代码

你不必处理持久化存储

或者身份验证等等事务

你只要构建客户端的HTML CSS以及JavaScript

专注于提升用户体验

那么接下来我们就一步一步地来看我们应该

怎么用Realtime API来构建我们的meme应用

我们首先需要做的

就是包含一个加载Realtime API的模板

接着我们需要从我们想从叫做

Realtime数据模型的地方读写数据

由于这是一个多人协作应用

我们还需要处理来自其他用户的改动

所以我们先来配置这个模板

我保证这不会很麻烦

首先我们需要包含的

就是标准Google API加载脚本

现在这个脚本和你用来

加载Google+按钮以及Google Drive API

或者其他的Google API的脚本一样

就只是一些复制粘贴的代码

接下来我们就需要

调用JavaScript函数来加载这些API

函数名是gapi.load

我们提供了一个所需的Google API的列表

在我们这个例子中 我们需要的是Realtime API

但是我们可能也想要添加一些验证码

或者是分享对话框又或是Drive API

以及其他类似的东西

我们能提供所需要的所有API

一旦所有东西都被加载完毕 我们会得到一个回调

我们可以直接用它来绑定到我们的UI上

这就是我们的模板

现在我们就可以着手开始实现真正酷的那一部分了

也就是我们用来从实时数据模块来读写数据的那部分

那么什么是实时数据模型呢

我们现在就来谈谈

看起来像是一个高大上的东西 但是实时数据模型

只是一个很多数据结构的集合

就像一个内存的数据模型

Realtime 数据模型中很酷的一块就是

Google帮你处理所有的协作

以及存储工作

所以你只需要从Realtime数据模型中读写数据

就像是在读写内存的数据一样 你只需要编写位于上层的

用户交互界面 剩余的事情都可以帮你处理

那么我们来看几个例子来了解一下

实时数据模型到底是怎么构建的

我们可以用各种不同的对象来构建它

但在这个例子中我们用协作图

以及协作字符串来构建

协作图就好像一个JavaScript的关联数组

除了我们会自动融合改变

基于按键的更改来处理协作

协作字符串就像是一个JavaScript字符串

除了我们会逐字符地比较来保证

最终结果是每个人得到相同的文本

那我们现在就来开始构建我们的数据模型

在根部我们延展出一个协作图

我们把它创造性地称为“根”

事实上 每一个Realtime数据模型

在它们的根部都有一个协作图

这是我们为你自动创建的

作为提供的一系列便利之一

这里可以储存你的应用

需要的所有数据

在我们这个例子中需要三个不同的字符串

即顶部 中部和底部的文本

我们这里用协作字符串

因为我们想实现基于字符的协作

如果我们不需要基于字符的协作

就好比这个例子中图片的URL

我们在这里用一个纯JavaScript字符串就好了

只要把它放到协作map中

就像是一个本地的数据结构

接着我们看看从数据模型中

读取和写入数据

对于读取 比如说我们要获取图片的URL

我们只要在协作map上调用get函数

就像是一个内存map一样

我们得到了图片的URL 就是那只可爱的猫的图片

如果我想更新它 比如换成一只更可爱的猫

我们只要调用set就行了

这看起来十分简单 因为它就是如此简单

这跑起来就像一个先前常规的JavaScript对象一般

但是在底层我们做的

就是序列化它然后发送到服务器

处理协作以及处理持久化

这一切都是自动为你做的

还有一件需要知道的事情是

要做到这些和构建一个

无协作的应用有所区别的是

你需要响应来自其他用户的事件

而不仅仅是本地用户

在Realtime API中 我们对于协作对象

提供事件监听就像DOM元素一样

你可以为协作字符串添加事件监听

可以为HTML的input元素添加事件监听

或者把这些通过一些粘合代码结合在一起

如果你不想像这样

把字符串和文本框连接起来

我们提供了一个叫做字符串绑定的智能组件

字符串绑定会为你自动

连接起协作字符串与一个input元素

之间的所有事件

所以我们要做的就是调用绑定字符串然后提供

绑定字符串以及input元素

我们会自动处理所有事件以及所有的

协作工作

这里我们还需要额外做一些工作

来使文本框工作 我们也需要在图片更新之后

有一个预览

然后让预览的图片更新

我们想让它在数据模型中的任何数据改变的时候发生变化

这里我们就需要使用到

一个叫做对象改变事件监听的东西

对象改变事件监听就是

一个监听任何时间任何对象

或者其任何子对象改变的东西

在我们的例子中 我们会把它添加到根

随着它被添加到根 我们就制造了一个

可以监听数据模型里

任何时间发生的任何事的监听器

然后我们就能更新我们的预览图片

这就是了

我们已经构建了一个协作meme编辑器应用

所以当你准备开始写代码的时候

在我们的开发者网页上有一个很赞的快速开始指南

在那里你可以一步一步地跟着实例代码学习

它会带着你制作一个小型演示应用

如果你对实时API

工作的技术细节感兴趣的话

我们去年的Google I/O大会有一个不错的演讲

在那里我们会研究冲突的解决方案

或者避免出现冲突 并且展现详细的技术细节

感谢你的收看

Youtube
Youtube
加入 GDG 字幕组
video_screenshot