android TV-Building TV Channels,Developing a TV Input Service
》Building TV Channels
To provide your users a similar experience, use the TV Input Framework to create channels for publishing video or music content so that your media appears alongside traditional
TV channels in the programming guide.
Android supports receiving and playback of live video content through the TV Input Framework in Android 5.0 (API level 21). This framework provides a unified method for receiving
audio and video channel content from hardware sources, such as HDMI ports and built-in-tuners, and software sources, such as video streamed over the internet.The framework enables
developers to define live TV input sources by implementing a TV input service.
The TV Input Framework is designed to provide access to a wide variety of live TV input sources and bring them together in a single user interface for users to browse, view, and
enjoy content. Building a TV input service for your content can help make it more accessible on TV devices.
》Developing a TV Input Service
With the TV input service, you can provide parental controls, program guide information, and content ratings.
> To develop a TV input service, you implement the following components:
TvInputService
provides long-running and background availability for the TV inputTvInputService.Session
maintains the TV input state and communicates with the hosting appTvContract
describes the channels and programs available to the TV inputTvContract.Channels
represents information about a TV channelTvContract.Programs
describes a TV program with data such as program title and start timeTvTrackInfo
represents an audio, video, or subtitle trackTvContentRating
describes a content rating, allows for custom content rating schemesTvInputManager
provides an API to the system TV app and manages the interaction with TV inputs and apps
TvInputService
.
Within that declaration, specify the BIND_TV_INPUT
permission
to allow the service to connect the TV input to the system. A system service (TvInputManagerService
) performs the binding and has that permission. The
system TV app sends requests to TV input services via the TvInputManager
interface.
The service declaration must also include an intent filter that specifies the TvInputService
as
the action to perform with the intent. Also within the service declaration, declare the service meta data in a separate XML resource. <service android:name="com.example.sampletvinput.SampleTvInput" android:label="@string/sample_tv_input_label" android:permission="android.permission.BIND_TV_INPUT"> <intent-filter> <action android:name="android.media.tv.TvInputService" /> </intent-filter> <meta-data android:name="android.media.tv.input" android:resource="@xml/sample_tv_input" /> </service>
<tv-input xmlns:android="http://schemas.android.com/apk/res/android" android:setupActivity="com.example.sampletvinput.SampleTvInputSetupActivity" />
>the onCreate()
method initializes theCaptioningManager
and prepares to handle theACTION_BLOCKED_RATINGS_CHANGED
andACTION_PARENTAL_CONTROLS_ENABLED_CHANGED
actions. These actions describe system intents fired when the user changes the parental control settings, and when there is a change on the list of blocked ratings.
@Override public void onCreate() { super.onCreate(); mHandlerThread = new HandlerThread(getClass() .getSimpleName()); mHandlerThread.start(); mDbHandler = new Handler(mHandlerThread.getLooper()); mHandler = new Handler(); mCaptioningManager = (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE); setTheme(android.R.style.Theme_Holo_Light_NoActionBar); mSessions = new ArrayList<BaseTvInputSessionImpl>(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(TvInputManager .ACTION_BLOCKED_RATINGS_CHANGED); intentFilter.addAction(TvInputManager .ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED); registerReceiver(mBroadcastReceiver, intentFilter); }> The
TvInputService
creates
a TvInputService.Session
that
implements Handler.Callback
to
handle player state changes. With onSetSurface()
,
the TvInputService.Session
sets
the Surface
with
the video content.
The TvInputService.Session
handles
the onTune()
event
when the user selects a channel, and notifies the system TV app for changes in the content and content meta data. These notify()
methods are described
inControl Content and Handle
Track Selection further in this training.
The system TV app works with the setup activity you define for your TV input. The setup activity is required and must provide at least one channel record for the system database. The system TV app will invoke the setup activity when it cannot find a channel for the TV input.
相關文章
- Android TV-Building Layouts for TVAndroidUI
- android tv-Building TV GamesAndroidUIGAM
- Android TV-Building TV Apps,Get Started with TV AppsAndroidUIAPP
- android TV-Building a Details View,Displaying a Now Playing CardAndroidUIAIView
- Android TV開發——RecyclerView For TVAndroidView
- Android TVAndroid
- android tv-TV Apps ChecklistAndroidAPP
- Android TV-Handling TV HardwareAndroid
- Android TV-Creating TV NavigationAndroidNavigation
- android TV-Recommending TV Content,Android
- android TV-Making TV Apps Searchable,Searching within TV AppsAndroidAPP
- 一起看 I/O | Google TV 和 Android TV OS 的最新進展GoAndroid
- Android TV開發總結【RecycleView】AndroidView
- android TV-Working with Channel DataAndroid
- android tv-Managing User InteractionAndroid
- Java TV MHPJava
- PcMagazine:羅技TV、谷歌TV、Roku XDS三大網際網路TV引數對比谷歌
- stf 怎麼使用在 android tv 上Android
- Android TV版小米盒子專版亮相Android
- Android TV端RecyclerView焦點亂跑AndroidView
- Android Jetpack - Android TV 應用開發教程AndroidJetpack
- 鬥魚TV回應直播造人 鬥魚TV直播造娃娃事件始末事件
- [譯]利用 Android 構建 TV 的未來Android
- [譯] 利用 Android 構建 TV 的未來Android
- [譯]SearchFragment --Android TV 開發手冊十二FragmentAndroid
- 蘋果最新的Apple TV怎麼樣?全新Apple TV解析蘋果APP
- 聊聊真實的 Android TV 開發技術棧Android
- 如何在Android TV 桌面新增自定義頻道/節目Android
- 小米和Google合作:Android TV版小米盒子進軍美國GoAndroid
- 微信小程式開發--『狗蛋TV』微信小程式
- Google TV以何定成敗Go
- Android TV版電視盒子亮相 小米和Google看著樂AndroidGo
- android TV - Creating a Catalog Browser,Providing a Card ViewAndroidView
- Android TV曝出bug 或導致使用者私人照片洩露Android TV新漏洞:你的照片可能出現在他人的電視中!Android
- 安卓 TV 怎麼安裝證書?安卓
- Total Variation(TV)去噪演算法演算法
- Useful Techniques in Developing On-demand Service ApplicationdevAPP
- Google:Android TV月活裝置數已超8000萬臺GoAndroid