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
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
Java 27新機能 / Java 27 new features
kishida
2
150
cdk deploy JawsSonic #MARATHONしながらAWSリソースをデプロイしてみよう
akihisaikeda
2
140
wkhtmltopdfの次どうするか問題2026
willnet
2
1.6k
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
290
すこし踏み込む CancellationToken
htkym
2
720
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
130
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
500
Verilogで学ぶCPU自作入門.pdf
uyuki234
1
490
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
410
XP祭りでしか伝わらないフリップネタ #xpjug
murabayashi
0
150
iOSDC2026登壇資料.pdf
riofujimon
0
170
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
850
Featured
See All Featured
Game over? The fight for quality and originality in the time of robots
wayneb77
1
290
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
HDC tutorial
michielstock
2
880
Into the Great Unknown - MozCon
thekraken
41
2.7k
WENDY [Excerpt]
tessaabrams
14
39k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
Abbi's Birthday
coloredviolet
4
10k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
510
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