SlideShare a Scribd company logo
PinP機能をWebRTCで実現
できるか検証してみた
2018/10/29
@monmee
$ whoami
本名: 西川裕登(にしかわゆうと)
GitHub: https://github.com/monmee
Twitter: @monmi_monmi
Organization: NTTコミュニケーションズ
みなさん、
Picture-in-Pictureって
ご存知ですか?
・ひとつの画面の隅などに小さく別の画面の表示領域を設け、両方の画
面を同時に表示させておけるようにする表示法のこと。
(Weblio辞書から引用)
https://www.weblio.jp/content/%E3%83%94%E3%82%AF%E3%83%81%E3%83%A3%E3%83%BC%E3%82%A4%E3%83%B3%E3%83%94%E3%82%
AF%E3%83%81%E3%83%A3%E3%83%BC
Picture-in-Pictureとは
(例)YouTube(Android版スマホ)におけるPinP
(例)YouTube(Android版スマホ)におけるPinP
(例)YouTube(Android版スマホ)におけるPinP
(例)YouTube(Android版スマホ)におけるPinP
これ
・実はPinPについて知らなかった
・ITmediaの記事でPinPを知った
・どうやらM70 Desktopから使えるように
なったらしい
・ほー、なんか便利そう
・ここで素朴な疑問が浮かんだ
PinP on WebRTCを調べようと思ったきっかけ
http://www.itmedia.co.jp/news/articles/1810/21/news008.html
これ、MediaStream
だと使えるん?
調査してみた
・2016/06にios9.0で AVPictureInPictureControllerが追加されたよ
・2016/09にsafari9.0でブラウザ実装されたよ
https://developer.apple.com/library/archive/releasenotes/General/WhatsNewInSafari/Articles/Safari_9_0.html
・その6ヶ月後にAndroid 8.0のリリース時に実装されたよ
https://developer.android.com/about/versions/oreo/android-8.0#opip
・Chrome M68 for Desktopから実験的に実装されたよ
https://twitter.com/KevinCTofel/status/996040615648485376
・2018/10/19にM70でデフォルトで有効になったよ
https://plus.google.com/+FrancoisBeaufort/posts/CmhhqTpbC1b
・ChromiumからMedia Streamに対応したとの報告あり
https://chromium-review.googlesource.com/c/chromium/src/+/1196515
PinPの背景
・2016/06にios9.0で AVPictureInPictureControllerが追加されたよ
・2016/09にsafari9.0でブラウザ実装されたよ
https://developer.apple.com/library/archive/releasenotes/General/WhatsNewInSafari/Articles/Safari_9_0.html
・その6ヶ月後にAndroid 8.0のリリース時に実装されたよ
https://developer.android.com/about/versions/oreo/android-8.0#opip
・Chrome M68 for Desktopから実験的に実装されたよ
https://twitter.com/KevinCTofel/status/996040615648485376
・2018/10/19にM70でデフォルトで有効になったよ
https://plus.google.com/+FrancoisBeaufort/posts/CmhhqTpbC1b
・ChromiumからMedia Streamに対応したとの報告あり
https://chromium-review.googlesource.com/c/chromium/src/+/1196515
PinPの背景
なんか使えそう!
・WICGという標準化団体がPicture-in-Picture Web APIを絶賛作成中
https://wicg.github.io/picture-in-picture/
・video.requestPictureInPicture(); PinPモードを開始
・document.exitPictureInPicture(); PinPモードを終了
PinP API
PinP on WebRTC
検証してみる
・各ブラウザアプリ、各バージョンでPinP on WebRTCが動くか検証
・M70, M71, M72
・FF62, FF63
・Safari 12
・サンプルアプリはSkyWayのp2p-videochat exampleをベースに作成
https://github.com/skyway/skyway-js-sdk/tree/master/examples/p2p-videochat
検証内容
検証結果(M70)
検証結果(M72)
・✗ FF62/FF63: document.pictureInPictureEnabled = false;
・✗ Safari12: document.pictureInPictureEnabled = false;
・✗ M70: NotSupportedError
・✔M71: The use of VideoLayer for video Picture-in-Picture is not supported
-> chrome://flags/#enable-surfaces-for-videos
-> [Enable the use of SurfaceLayer objects for videos.] をEnabled
・✔ M72
検証結果(まとめ)
・Safari12はAVKit使うとPinP on WebRTCできる
検証結果(ちなみに)
video.webkitSetPresentationMode(video.webkitPresentationMode ===
"picture-in-picture" ? "inline" : "picture-in-picture");
DEMO
・MediaStreamでもPinPは使える
・PinPウィンドウ内のカスタマイズやりたい
・接続相手の名前表示
・他の接続相手にウィンドウを切り替えるなどのメニューを作るとか
(知見募集中です!)
まとめ
余談: 調査は1泊2日の開発合宿で行いました
最高!
おしまい

More Related Content

PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
PDF
エキスパートPythonプログラミング改訂3版の読みどころ
PDF
MicroPythonで作る人工生命っぽい何か
PDF
mmoの作り方
PDF
MMDAgent DAYの展示説明
PDF
『自走プログラマー』 が我々に必要だった理由
PDF
[PyConJP2019]Pythonで切り開く新しい農業
PPTX
講義「メディアアート」第12回 メディアアートを作る
2024 Trend Updates: What Really Works In SEO & Content Marketing
エキスパートPythonプログラミング改訂3版の読みどころ
MicroPythonで作る人工生命っぽい何か
mmoの作り方
MMDAgent DAYの展示説明
『自走プログラマー』 が我々に必要だった理由
[PyConJP2019]Pythonで切り開く新しい農業
講義「メディアアート」第12回 メディアアートを作る
Ad

PinP機能をWebRTCで実現できるか検証してみた