- Беспроводной дисплей для Android
- Многообразие функций и возможностей
- Варианты использования режима двух дисплеев:
- Создаем Android приложение для двух дисплеев
- How to Connect an Android Phone or Tablet to a TV
- Mirror your screen, with or without wires
- What to Know
- Connect Android to Your HDTV With a Micro HDMI to HDMI Cable
- Go Wireless With a Google Chromecast
- Connect to Your TV Using MHL
- Connect to Your HDTV Using SlimPort
- Connect Your Android Device With Roku or Other Wireless Solutions
- Connect Your Samsung Smartphone or Tablet with Your Samsung HDTV
- Confused? Go With the Chromecast
Беспроводной дисплей для Android
Многообразие функций и возможностей
О стандарте WiDi мы уже рассказывали достаточно: следили за новостями, рассматривали с точки зрения разработчика и даже тестировали живой серийный адаптер. Теперь для начала опишем в нескольких словах технологию Miracast.
Общая коцепция Miracast
Miracast представляет собой технологию передачи мультимедийной информации (аудио и видео) посредством WiFi. В качестве транспорта в нем используется стандарт WiFi Direct, позволяющий двум устройствам обмениваться данными друг с другом без помощи дополнительной сетевой инфраструктуры. Попросту говоря, Miracast можно представить, как беспроводной HDMI.
Miracast еще довольно молод: официальная сертификация Miracast устройств альянсом WiFi Alliance началась чуть более года назад. Для передачи видео используется кодек Н.264, звук может быть двух- или пятиканальным. Miracast является открытым стандартом, не принадлежащим какой-либо компании; его привлекательность еще более повысилась после того, как в прошлом году его поддержка была добавлена в ОС Android 4.2. Замечу сразу, что в Android 4.2 на конкретном устройстве не гарантируется наличие Miracast – это надо выяснять дополнительно. Полный список сертифицированных устройств- как передатчиков, так и приемников можно посмотреть на сайте WiFi Alliance.
Архитектура Miracast (со стороны передатчика)
Совместимость Miracast и WiDi версии 3.5 означает общность базового функционала в устройствах обоих стандартов. Какие дополнительные плюшки есть в WiDi, но отсутствуют в Miracast? На сей день их три:
- обязательная поддержка HD видео вплоть до 1080p (хотя стандарт Miracast допускает высокое разрешение, но не обязывает все устройства поддерживать его);
- поддержка системы защиты контента HDCP (High-bandwidth Digital Content Protection);
- наличие двух дополнительных видео режимов – расширенного и многозадачного (о них чуть позже).
Таким образом, можно сказать, что WiDi в настоящее время является функциональным продолжением Miracast.
WiDi поддерживается большинством существующих мобильных платформ Intel (и наверняка будет поддерживаться последующими). Как уже отмечалось в тестировании, технология относится к разряду «однокнопочных», то есть предельно простых для пользователей.
Процесс подключения беспроводного дисплея на примере Samsung Galaxy S4
Ну а теперь пришло время поговорить о режимах. Нативным для WiDi/Miracast является Режим Клонирования – на удаленном дисплее отображается та же картинка, что и на локальном, с тем же разрешением.
Двойной режим также относится к основным; в нем на удаленном дисплее проигрывается контент, а основной служит для управления и вывода служебной информации. Данный режим поддерживается через Android Presentation API.
Расширенный режим имеется только в WiDi (и, соответственно, доступен только для устройств на платформе Intel Atom). В нем видео режим включается автоматически, когда пользователь запускает мультимедийный контент на плеере, использующим Android Media Player framework. Разрешение картинки остается «родным» вплоть до 1080р. При этом локальный рендеринг видео может отключаться для сокращения энергопотребления.
Наконец, самый продвинутый – Многозадачный Режим, при котором видео плеер посылает изображение на удаленный дисплей, а на локальном в это время пользователь делает, что хочет: просматривает интернет, принимает звонки или даже смотрит совсем другое видео, тоже в FullHD разрешении!
Варианты использования режима двух дисплеев:
Режим двух дисплеев подходит не только для просмотра видео. Совершенно несложно набросать список жизненных его применений:
- просмотр интернет на большом экране (смартфон выступает в роли тачпада);
- заполнение форм или набор небольших текстов (смартфон – сенсорная клавиатура);
- игры (смартфон – сенсорный геймпад/джойстик);
- мобильное рабочее место (смарфтон – компьютер, к нему по Bluetooth подключена периферия).
Создаем Android приложение для двух дисплеев
Поддержка второго беспроводного дисплея в Android 4.2 (API Level 17) реализована с помощью с помощью класса Presentation, позволяющего:
- внедрить поддержку второго дисплея в приложения, не заботясь о способе, которым он будет физически подключен;
- работать с MHL, HDMI, Slimport или Miracast совместимыми устройствами;
- осуществлять управление вторым дисплеем независимо от первого.
Presentation является базовым классом и должен быть расширен:
Также необходима ассоциация с классом Display при создании. Presentation наследуется от Dialog, а что касается Dialog, то его жизненный цикл привязан к Activity.
Перед тем, как задействовать Presentation, вам необходимо выбрать дисплей, что может быть сделано двумя способами:
1. MediaRouter API (в API 16) – система сама выберет лучший дисплей за вас
2. Display Manager API (в API 17) – перечень дисплеев.
Добавление MediaRouteButton в приложение:
Как заставить Presentation API работать:
Далее, используя MediaRouter.addCallback, необходимо мониторить:
- onRouteUnselected
- onRouteSelected
- onRoutePresentationDisplayChanged
А внутри активности, которая владеет Presentation:
- onResume
- onPause
API для управления WiFi дисплеями присутствуют внутри Android AOSP, но не являются частью Android framework. Параметры беспроводного дисплея могут быть вызваны через Intentandroid.settings.WIFI_DISPLAY_SETTINGS, но и он также не входит во фреймворк. Некоторые производители используют другие варианты: Samsung – com.samsung.wfd.LAUNCH_WFD_PICKER_DLG, HTC – com.htc.wifidisplay.CONFIGURE_MODE_NORMAL.
Все API, приведенные на рисунке ниже, являются внутренними для Android 4.2/4.3. Они являются частью AOSP и распространяются свободно, однако не входят во фреймворки и работать не обязаны.
В заключение отметим, что тестировать приложения для двух дисплеев можно как на реальном железе, поддерживающем данный функционал, так и на эмуляции, доступной начиная с Android 4.2 в опциях разработчика. Вы можете выбрать разрешение и dpi второго виртуального дисплея, и получите оверлей с его отображением.
При подготовке поста использовались материалы IDF 2013, авторы — Xavier Hallade и Costas Stylianou.
Источник
How to Connect an Android Phone or Tablet to a TV
Mirror your screen, with or without wires
What to Know
- Cheapest and easiest way: use an HDMI cable.
- Next best way: use Google Chromecast.
- Other options include using an MHL (Mobile High Definition Link), SlimPort, or a wireless solution like Roku.
This article explains how to connect an Android smartphone or tablet to your TV. Instructions apply to most Android phones, no matter the manufacturer, including Samsung, Google, Huawei, and Xiaomi.
Connect Android to Your HDTV With a Micro HDMI to HDMI Cable
The cheapest, the easiest and perhaps the best way to connect your Android device to your HDTV is with an HDMI cable. It isn’t as common for manufacturers to include a Micro HDMI port in their device as it was just a few years ago but if you are lucky enough to have one, it makes the entire experience much easier.
Micro HDMI to HDMI cables are roughly the same cost as a regular HDMI cable, so you can get one for as cheap as $20 or less. You can find them in local electronics stores.
After you plug your device into one of your TV’s HDMI inputs, switch the TV’s source (usually through a source button on the remote) to the HDMI port and you are good to go. Ensure the Android device is in landscape mode to obtain the best viewing experience. While Apple has stuck with the 4:3 aspect ratio with the iPad — which is great for browsing the web, Facebook and the computer side of tablets — most Android tablets sport a 16:9 aspect ratio that looks great on those big HDTV screens.
The big disadvantage to going with a wired solution is the difficulty in using the device while you have it connected to the TV. If you are watching a movie, this limitation isn’t a big deal, but if you want to play a game or watch YouTube videos, it isn’t ideal.
Go Wireless With a Google Chromecast
Google’s Chromecast is the cheapest alternative if you don’t have a Micro HDMI port on your device. But don’t mistake it for similar streaming devices like Roku, Apple TV or Amazon Fire TV — the Chromecast dongle doesn’t actually do anything on its own. It relies on your Android device to be the brains behind the operation, while it simply casts your Android screen onto your television set.
The biggest advantage of Chromecast is the price tag, which comes in at under $40. Another really cool feature is the compatibility with both Android and iOS devices. While you can only do true display mirroring with an Android smartphone or tablet, you can still cast video from Netflix, Hulu, or any other Chromecast-compatible app from your iPhone or iPad. This versatility is great for households that have both major mobile platforms.
And Chromecast setup is easy. After you plug the dongle into your TV and attach the power cable, download and launch the Google Home app. This app will detect the Chromecast and establish a connection to help set it up. It can even transfer over your Wi-Fi information device automatically on some devices. Google Home is also the app you use to mirror your display, although, with many popular apps like YouTube, you simply need to tap the cast icon, which looks like a box or TV with the Wi-Fi symbol in the corner.
Connect to Your TV Using MHL
Mobile High Definition Link is the technical term for a Micro USB to HDMI adapter. Many of the top brands support MHL for their Android smartphones and tablets, although you may need to double-check your own device by browsing a list of all mobile devices that support MHL.
This connection offers the same benefits as connecting through a Micro HDMI port, but it is slightly more expensive because of the need for the MHL adapter, which can cost between $15 and $40. This option can be more expensive than a Chromecast.
Like the Micro HDMI to HDMI solution, it just works. You shouldn’t need to do anything special other than making sure your smartphone or tablet is in landscape mode to get the best viewing experience.
Samsung has dropped support for MHL and all other protocols for sending video and audio over USB, so if you have a newer Samsung smartphone like the Galaxy S6 or Galaxy S6 Edge, you will need to go with a wireless solution like the Chromecast. Samsung tablets generally do not support Chromecast at this time.
Connect to Your HDTV Using SlimPort
SlimPort is a new technology designed for all sorts of devices from smartphones to tablets to cameras. It uses the same basic technology as DisplayPort to pass audio and video to a television or monitor. It has growing support that includes devices like the LG V20, Acer Chromebook R13, HTC 10, LG G Pad II and Amazon Fire HD tablets. You can check SlimPortConnect’s list to see if your device has a SlimPort.
SlimPort operates much the same as MHL. You will need a SlimPort adapter that costs between $15 and $40 and you will need an HDMI cable. After you buy the adapter and cable, setup is straightforward.
Connect Your Android Device With Roku or Other Wireless Solutions
Chromecast isn’t the only game in town when it comes to wireless, although it may be the cheapest and easiest solution. The Roku 2 and newer boxes by Roku support casting. You can find the screen-mirroring option in the settings of the Roku.
On the Android device, open the Android’s Settings app, go to Display and choose Cast to see available options for casting the screen. Both devices must be on the same network.
A few brands like the Belkin Miracast Video Adapter and the ScreenBeam Mini2 also support casting your mobile screen to your TV. However, with price tags that easily exceed the Chromecast, it’s hard to recommend these solutions. The Roku can be a good choice for those who want a Roku or similar streaming device without the need to always connect your smartphone or tablet, but with the option of doing so.
Connect Your Samsung Smartphone or Tablet with Your Samsung HDTV
Check if your TV supports Samsung-to-Samsung mirroring by going into the Menu, choosing Network and searching for Screen Mirroring. On your smartphone or tablet, pull down the extended notifications using two fingers to swipe from the very top edge of the display downwards. You will see a «Screen Mirroring» or «Smart View» option if your device supports it.
Confused? Go With the Chromecast
If you are unsure of which ports are on your smartphone or tablet, the easy choice is to go with a Google Chromecast. And in most cases, this is also the least expensive option.
Chromecast will allow you to both cast video from most of your favorite streaming apps and mirror your display for apps that don’t support casting. It’s also relatively easy to set up, and because it works wirelessly, you can have your device in your hands on the couch while you cast the screen to your TV.
Источник