Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to New Cast SDK (v3)
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
330
2023 Flutter/Dart Summary
wasabeef
0
140
I/O Extended 2023 - Dart と Flutter の新機能
wasabeef
0
240
I/O Extended 2023 - Flutter 活用事例
wasabeef
10
3.1k
What it Takes to be a Flutter Developer
wasabeef
0
260
FlutterKaigi 2022 Keynote
wasabeef
1
740
Flutter Hooks を使ったアプリ開発 / App Development with the Flutter Hooks
wasabeef
2
1.5k
Flutter 2021 の振り返りと今後のアプリ開発に向けて / Looking back on Flutter 2021 and for future app development.
wasabeef
4
2.2k
Other Decks in Programming
See All in Programming
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
170
複数の Claude Code が"放置"されてしまう問題をCLI ダッシュボードを自作して解決した話
sumihiro3
1
720
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
710
AIに既存システムを理解させる技術 ~レガシーを見捨てないハーネスエンジニアリング入門~
ochtum
0
140
170k Jobs a Day on GKE: Scaling Mercari's CI Platform - and What's Next for AI-Native Development
junyaokabe
0
120
運用ダッシュボードの設計を誰も教えてくれないのだけどみなさんどうしてるんですか? - チームに監視するという文化を根付かせるための第一歩を踏みたい -
satoshi256kbyte
1
140
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
370
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
1.6k
いまどきの Codex で開発する visionOS アプリの開発スタイルについて
karad
0
160
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
400
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
340
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
120
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
250
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Exploring anti-patterns in Rails
aemeredith
3
470
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
420
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
270
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
580
How to Think Like a Performance Engineer
csswizardry
28
2.7k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Product Roadmaps are Hard
iamctodd
55
12k
Designing for humans not robots
tammielis
254
26k
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