Live Channels is an app made by Google which allows third-party developers to create their own input services. This can be done using Google’s TvInputFramework, and simplified further with my open source ChannelSurfer library.
This triage of channels works fairly well at providing users an ample amount of high-quality content. However, users have continued to look for more features in the app, one of the biggest of which is the ability to pause and resume playback. A normal cable box and DVR gives users the ability to pause live TV or even skip backward if they missed something. If you have to run a short errand after a few minutes, you want the stream to stop at its current position until you return.
Although there do not appear to be any apps that will give this functionality currently, after looking through the APIs of Live Channels, this functionality does appear to be supported. A supported app will add a third row of options, above the channel guide, called Playback Controls.
TvInputService.Session class, there are a number of methods relating to time shifting. For a service to implement this,
must be called. From there, a number of methods can be overridden.
public void onTimeShiftPause ()
public void onTimeShiftResume()
These two methods, when overriden, will provide logic for when your media is going to be stopped and resumed.
Users will likely also want to go back and forth through the stream, perhaps catching up to realtime or trying to rewatch a certain point. There are a few methods to override here that give a look at what will be possible.
public long onTimeShiftGetStartPosition()
public long onTimeShiftGetCurrentPosition()
public void onTimeShiftSeekTo(long timeMs)
The user can seek to any position in the channel between the beginning and current positions, which are controlled by the third-party app. If the program changes, perhaps the start position will change as well.
public void onTimeShiftSetPlaybackParams(PlaybackParams params)
also is available, which changes when the playback speed changes (ie. rewinding).
This functionality was just added in Android 6.0, Marshmallow, so it won’t be available to most devices right now. Additionally, apps will have to implement this individually. By default time shifting is not available, and there is no system wide ability. ChannelSurfer will be updated soon to add support time shifting. For app developers who’ve made their own service, they may want to look into these APIs and try implementing them.
It is possible that Android N includes DVR functionality in Live Channels. Now that the media playback controls have been implemented, adding the ability to record live channels and play them back later seems more possible than before. The documentation hints that some sort of recording will be in place.
public long onTimeShiftGetStartPosition ()
Added in API level 23
Returns the start playback position for time shifting, in milliseconds since the epoch. Returns TIME_SHIFT_INVALID_TIME if the position is unknown at the moment.
The start playback position of the time shifted program should be adjusted when the implementation cannot retain the whole recorded program due to some reason (e.g. limitation on storage space). It is the earliest possible time position that the user can seek to, thus failure to notifying its change immediately might result in bad experience where the application allows the user to seek to an invalid time position.