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
実用 Picture in Picture
Search
aosa4054
June 18, 2019
Programming
940
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
実用 Picture in Picture
aosa4054
June 18, 2019
More Decks by aosa4054
See All by aosa4054
Now in Android Overview
aosa4054
1
1.5k
LazyVerticalGridに学ぶ 非スクローラブルなグリッドの作り方
aosa4054
0
810
自作アプリのアイコンを作った話
aosa4054
0
260
Other Decks in Programming
See All in Programming
phperだってパンチカードでコーディングしたい
o0h
PRO
0
460
残高管理から台帳サービスへの進化
artoy
1
210
Next.js: The final boss of Web Performance
guaca
0
340
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
140
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
310
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
130
APNsからLive Activityを開始する話
yumnumm
0
180
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
280
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
320
PyConTW 2026 - AI Coding 不只是工具升級, 區域醫院醫療資訊系統協作開發與資訊團隊轉型實踐
cclai999
0
200
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
840
Modernizing iOS Apps
seyfoyun
0
120
Featured
See All Featured
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
440
Documentation Writing (for coders)
carmenintech
77
5.6k
Leo the Paperboy
mayatellez
10
2.4k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
550
Game over? The fight for quality and originality in the time of robots
wayneb77
1
310
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
580
We Have a Design System, Now What?
morganepeng
55
8.4k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
Making the Leap to Tech Lead
cromwellryan
135
10k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
Unsuck your backbone
ammeep
672
58k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
900
Transcript
実⽤ Picture in Picture 2019.06.18 Shota Ara Mirrativ, Inc. ©
2019 Mirrativ, Inc. potatotips #62
99 ⾃⼰紹介
Shota Ara • Internship @Mirrativ • Android app dev •
Twitter: aosa4054(あおさ) • GitHub: aosa4054
99 Picture in Pictureとはなんぞや
動画です!
端末の設定に⾶ぶ 閉じる 拡⼤して元の画⾯に戻る RemoteAction(複数設定可) Picture in Picture画⾯の詳細
• 画⾯に⼩さいウインドウを出せる • 別のアプリを使いながらでも あるアプリを⾒続けられる • PIP中は限定された動作しかできない
• Android O以上 • Android TVのみNougatからでも使える • パーミッションを取る必要なし • 設定からユーザーが無効にすることができる
99 どうやるのか
enterPictureInPictureMode(PictureInPictureParams.Builder().build())
PictureInPictureParams.Builder
PictureInPictureParams.Builder Rational型の引数を渡して PIP画⾯の縦横⽐を指定できる
PictureInPictureParams.Builder IconとPendingIntentを含むRemoteActionを渡して PIP画⾯におけるアクションを設定できる。
PictureInPictureParams.Builder IconとPendingIntentを含むRemoteActionを渡して PIP画⾯におけるアクションを設定できる。 BroadCastReceiverで 購読すれば処理が可能
PictureInPictureParams.Builder 左右上下どの辺に寄りやすいか を指定できる
99 タスクとライフサイクル
通常のタスクとライフサイクル onCreate onStart onResume onPause onStop onDestroy 同⼀のタスクで⾏われる
Picture in Pictureのタスクとライフサイクル 当該Activityのみ別タスクへ enterPictureInPictureMode(PictureInPictureParams.Builder().build()) onPictureInPictureModeChanged onPictureInPicturModeChanged(isInPictureInPictureMode: Boolean)
Picture in Pictureのタスクとライフサイクル onPictureInPictureModeChanged(true) onStop onResume onPictureInPictureModeChanged(false) return dismiss onPause
Picture in Pictureのタスクとライフサイクル onPictureInPictureModeChanged(true) onResume onPictureInPictureModeChanged(false) return dismiss onPause onStop
onDestroyは呼ばれずに タスクも残り続ける
• ユーザーからすると 「消したはずのアプリがタスクに残り続けてる、、なんで?」 「同じアプリがタスクに⼆つあるんだけど、、」 となる • 復帰時とDismiss時で別々の処理を⾏えない • Activity. isInPictureInPictureModeというフラグはあるが
これではタイミングの問題でハンドリングできない なにが問題か
onPictureInPictureModeChanged(true) onStop onResume onPictureInPictureModeChanged(false) Activity. isInPictureInPictureMode = true onPause
なにが問題か • ユーザーからすると 「消したはずのアプリがタスクに残り続けてる、、なんで?」 「同じアプリがタスクに⼆つあるんだけど、、」 となる • 復帰時とDismiss時で別々の処理を⾏えない • 別にフラグを作って管理するしかない
onPictureInPictureModeChanged(true) onPictureInPictureModeChanged(false) こっちのタイミングでフラグを 管理することでonResume, onStop内で 復帰時とdismiss時で別々の処理をできる onResume onStop onPause
onPictureInPictureModeChanged(true) onPictureInPictureModeChanged(false) こっちのタイミングでフラグを 管理することでonResume, onStop内で 復帰時とdismiss時で別々の処理をできる onResume onPause onStop if(fromPictureInPicture)
finishAndRemoveTask() とか……
99 めんどい
99 フラグ管理をいい感じにするライブラリを作りました https://github.com/aosa4054/ PictureInPictureLifecycleObserver
99 PR
https://www.mirrativ.co.jp/recruit/