1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License
15  */
16 
17 package com.android.tv.ui.api;
18 
19 /** API to play pause and set the volume of a TunableTvView */
20 public interface TunableTvViewPlayingApi {
21 
isPlaying()22     boolean isPlaying();
23 
setStreamVolume(float volume)24     void setStreamVolume(float volume);
25 
setTimeShiftListener(TimeShiftListener listener)26     void setTimeShiftListener(TimeShiftListener listener);
27 
isTimeShiftAvailable()28     boolean isTimeShiftAvailable();
29 
timeShiftPlay()30     void timeShiftPlay();
31 
timeShiftPause()32     void timeShiftPause();
33 
timeShiftRewind(int speed)34     void timeShiftRewind(int speed);
35 
timeShiftFastForward(int speed)36     void timeShiftFastForward(int speed);
37 
timeShiftSeekTo(long timeMs)38     void timeShiftSeekTo(long timeMs);
39 
timeShiftGetCurrentPositionMs()40     long timeShiftGetCurrentPositionMs();
41 
42     /** Used to receive the time-shift events. */
43     abstract class TimeShiftListener {
44         /**
45          * Called when the availability of the time-shift for the current channel has been changed.
46          * It should be guaranteed that this is called only when the availability is really changed.
47          */
onAvailabilityChanged()48         public abstract void onAvailabilityChanged();
49 
50         /**
51          * Called when the record start time has been changed. This is not called when the recorded
52          * programs is played.
53          */
onRecordStartTimeChanged(long recordStartTimeMs)54         public abstract void onRecordStartTimeChanged(long recordStartTimeMs);
55     }
56 }
57