Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Introduction to New Cast SDK (v3)
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Daichi Furiya (Wasabeef)
August 07, 2016
Programming
190
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduction to New Cast SDK (v3)
Daichi Furiya (Wasabeef)
August 07, 2016
More Decks by Daichi Furiya (Wasabeef)
See All by Daichi Furiya (Wasabeef)
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
6
2.9k
About Flutter Architecture
wasabeef
1
340
2023 Flutter/Dart Summary
wasabeef
0
140
I/O Extended 2023 - Dart と Flutter の新機能
wasabeef
0
250
I/O Extended 2023 - Flutter 活用事例
wasabeef
10
3.1k
What it Takes to be a Flutter Developer
wasabeef
0
270
FlutterKaigi 2022 Keynote
wasabeef
1
760
Flutter Hooks を使ったアプリ開発 / App Development with the Flutter Hooks
wasabeef
2
1.6k
Flutter 2021 の振り返りと今後のアプリ開発に向けて / Looking back on Flutter 2021 and for future app development.
wasabeef
4
2.3k
Other Decks in Programming
See All in Programming
難しいけど、読めた。- OSSの入口に立った話。
sts11142
0
120
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
5
4.5k
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
160
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
390
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
360
Webの地図
yosuke_furukawa
PRO
6
4.7k
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
570
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
920
一人だけ、Kiroが静止する日
hideg
0
130
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
270
SONY CISC-NEWS NWS-1750 + NWB-225 フレームバッファの NetBSD/news68k ドライバ実装 / OSC2026Hiroshima
tsutsui
0
140
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
160
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
510
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.9k
We Are The Robots
honzajavorek
0
380
Chasing Engaging Ingredients in Design
codingconduct
0
340
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
430
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
430
Transcript
New Google Cast SDK wasabeef shibuya.apk #9
About me Daichi Furiya wasabeef @wasabeef_jp AbemaTV, Inc.
Chromecast http://www.google.co.jp/intl/ja_jp/chromecast
Sender
Sender
Sender
Receiver
Receiver
Receiver
Receiver
Receiver
Google Cast SDK v3
Session state management Connect, disconnect, and reconnect logic UX implementation
and UI Google Cast SDK v3
Sender
Gradle dependencies { compile "com.android.support:appcompat-v7:23.4.0" compile "com.android.support:mediarouter-v7:23.4.0" compile "com.google.android.gms:play-services-cast-framework:9.2.1" }
Initialize the Cast Context class CastOptionsProvider implements OptionsProvider { @Override
Public CastOptions getCastOptions(Context context) { CastOptions castOptions = new CastOptions.Builder() .setReceiverApplicationId("415D36F5") .build(); return castOptions; } }
Initialize the Cast Context <application> <meta-data android:name= "com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME" android:value="com.foo.CastOptionsProvider" />
</application>
Initialize the Cast Context @Override public CastOptions getCastOptions(Context context) {
NotificationOptions notificationOptions = new NotificationOptions.Builder() .setActions(Arrays.asList(MediaIntentReceiver.ACTION_SKIP_NEXT, MediaIntentReceiver.ACTION_TOGGLE_PLAYBACK, MediaIntentReceiver.ACTION_STOP_CASTING), new int[]{1, 2}) .setTargetActivityClassName(ExpandedControlsActivity.class.getName()) .build(); CastMediaOptions mediaOptions = new CastMediaOptions.Builder() .setNotificationOptions(notificationOptions) .build(); return new CastOptions.Builder() .setReceiverApplicationId("415D36F5") .setCastMediaOptions(mediaOptions) .build(); }
Initialize the Cast Context @Override public CastOptions getCastOptions(Context context) {
NotificationOptions notificationOptions = new NotificationOptions.Builder() .setTargetActivityClassName(MainActivity.class.getName()).build(); CastMediaOptions castMediaOptions = new CastMediaOptions.Builder() .setNotificationOptions(notificationOptions).build(); CastOptions castOptions = new CastOptions.Builder().setReceiverApplicationId("415D36F5") .setEnableReconnectionService(true) .setResumeSavedSession(true) .setCastMediaOptions(castMediaOptions) .setSupportedNamespaces(Collections.singletonList("urn:x-cast:jp.wasabeef")) .build(); return castOptions; }
Add a Cast Button
IntroductoryOverlay
IntroductoryOverlay new IntroductoryOverlay.Builder(this, button) .setTitleText("キャストを始めよう") .setOverlayColor(R.color.holo_blue_light) .setSingleTime() .build() .show();
Add a Cast Button <android.support.v7.app.MediaRouteButton android:id="@+id/media_route_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:mediaRouteTypes="user" android:visibility="gone"
/> @Override protected void onResume() { super.onResume(); CastButtonFactory.setUpMediaRouteButton(this, binding.mediaRouteButton); }
How session management works public class MainActivity extends Activity {
private CastSession castSession; private SessionManager sessionManager; private SessionManagerListener listener = new SessionManagerListener<CastSession>(){ @Override public void onSessionStarted(Session session, String sessionId) { // Connected } @Override public void onSessionEnded(Session session, int error) { // Disconnected } } @Override protected void onCreate() { super.onCreate(); CastContext cc = CastContext.getSharedInstance(this); sessionManager = cc.getSessionManager(); sessionManager.addSessionManagerListener(listener); } }
How session management works public class MainActivity extends Activity {
// … private CastSession castSession; private SessionManagerListener listener = new SessionManagerListener<CastSession>(){ @Override public void onSessionStarted(Session session, String sessionId) { // Connected } @Override public void onSessionEnded(Session session, int error) { // Disconnected } } }
How session management works public class MainActivity extends Activity {
private CastSession castSession; private SessionManager sessionManager; private SessionManagerListener listener; // … @Override protected void onCreate() { super.onCreate(); CastContext cc = CastContext.getSharedInstance(this); sessionManager = cc.getSessionManager(); sessionManager.addSessionManagerListener(listener); } }
Load Media MediaMetadata meta = new MediaMetadata(MediaMetadata.MEDIA_TYPE_TV_SHOW); meta.putString(MediaMetadata.KEY_TITLE, “わさビーフの奇妙な冒険 #1”);
meta.putString(MediaMetadata.KEY_SUBTITLE, "堅あげポテトは砕けない "); meta.addImage(new WebImage(Uri.parse(“https://wasabeef.jp/cover.webp")); MediaInfo mediaInfo = new MediaInfo.Builder(“https://wasabeef.jp/jojo-anim.m3u8") .setStreamType(streamType) .setContentType("application/x-mpegurl") .setMetadata(meta) .setCustomData(/** カスタムデータ:JSONObject **/) .build(); RemoteMediaClient client = castSession.getRemoteMediaClient(); client.load(mediaInfo, true, 0);
Recover from a temporary loss of WiFi Recover from device
sleep Recover from backgrounding the app Recover if the app crashed Automatic Reconnection
googlecast/ CastVideos-android
Receiver
Google Cast SDK Developer Console
Custom Receiver Styled Media Receiver Remote Display Receiver Receiver
Custom Receiver https://developers.google.com/cast/docs/custom_receiver
googlecast/ CastReferencePlayer
Conclusion
Thank you. twitter.com/wasabeef_jp wasabeef.jp github.com/wasabeef