NUGU SDK Linux  1.7.5
audio_player_interface.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 SK Telecom Co., Ltd. All rights reserved.
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 #ifndef __NUGU_AUDIO_PLAYER_INTERFACE_H__
18 #define __NUGU_AUDIO_PLAYER_INTERFACE_H__
19 
22 
23 namespace NuguCapability {
24 
25 using namespace NuguClientKit;
26 
42 enum class AudioPlayerState {
43  IDLE,
44  PLAYING,
45  STOPPED,
46  PAUSED,
47  FINISHED
48 };
49 
53 enum class AudioPlayerEvent {
54  UNDERRUN,
55  LOAD_FAILED,
56  LOAD_DONE,
57  INVALID_URL,
61 };
62 
66 enum class RepeatType {
67  NONE,
68  ONE,
69  ALL
70 };
71 
76 class IAudioPlayerListener : virtual public ICapabilityListener {
77 public:
78  virtual ~IAudioPlayerListener() = default;
79 
85  virtual void mediaStateChanged(AudioPlayerState state, const std::string& dialog_id) = 0;
86 
90  virtual void mediaEventReport(AudioPlayerEvent event, const std::string& dialog_id) = 0;
91 
96  virtual void durationChanged(int duration) = 0;
97 
102  virtual void positionChanged(int position) = 0;
103 
109  virtual void favoriteChanged(bool favorite, const std::string& dialog_id) = 0;
110 
116  virtual void shuffleChanged(bool shuffle, const std::string& dialog_id) = 0;
117 
123  virtual void repeatChanged(RepeatType repeat, const std::string& dialog_id) = 0;
124 
130  virtual void requestContentCache(const std::string& key, const std::string& playurl) = 0;
131 
138  virtual bool requestToGetCachedContent(const std::string& key, std::string& filepath) = 0;
139 };
140 
146 public:
147  virtual ~IAudioPlayerDisplayListener() = default;
148 
155  virtual bool requestLyricsPageAvailable(const std::string& id, bool& visible) = 0;
156 
162  virtual bool showLyrics(const std::string& id) = 0;
163 
169  virtual bool hideLyrics(const std::string& id) = 0;
170 
176  virtual void updateMetaData(const std::string& id, const std::string& json_payload) = 0;
177 };
178 
184  virtual public IDisplayHandler {
185 public:
186  virtual ~IAudioPlayerHandler() = default;
187 
192  virtual std::string play() = 0;
193 
199  virtual std::string stop(bool direct_access = false) = 0;
200 
205  virtual std::string next() = 0;
206 
211  virtual std::string prev() = 0;
212 
218  virtual std::string pause(bool direct_access = false) = 0;
219 
225  virtual std::string resume(bool direct_access = false) = 0;
226 
231  virtual void seek(int msec) = 0;
232 
238  virtual std::string requestFavoriteCommand(bool current_favorite) = 0;
239 
245  virtual std::string requestRepeatCommand(RepeatType current_repeat) = 0;
246 
252  virtual std::string requestShuffleCommand(bool current_shuffle) = 0;
253 
259  virtual bool setVolume(int volume) = 0;
260 
266  virtual bool setMute(bool mute) = 0;
267 
272  virtual void addListener(IAudioPlayerListener* listener) = 0;
273 
278  virtual void removeListener(IAudioPlayerListener* listener) = 0;
279 };
280 
285 } // NuguCapability
286 
287 #endif /* __NUGU_AUDIO_PLAYER_INTERFACE_H__ */
audioplayer's display listener interface
Definition: audio_player_interface.hh:145
virtual bool showLyrics(const std::string &id)=0
Request to the user to show the lyrics page.
virtual void updateMetaData(const std::string &id, const std::string &json_payload)=0
Request to update metadata the current display.
virtual bool requestLyricsPageAvailable(const std::string &id, bool &visible)=0
SDK request information about device's lyrics page available.
virtual bool hideLyrics(const std::string &id)=0
Request to the user to hide the lyrics page.
audioplayer handler interface
Definition: audio_player_interface.hh:184
virtual bool setMute(bool mute)=0
set media player's mute
virtual void removeListener(IAudioPlayerListener *listener)=0
Remove the Listener object.
virtual void addListener(IAudioPlayerListener *listener)=0
Add the Listener object.
virtual bool setVolume(int volume)=0
set media player's volume
virtual std::string requestShuffleCommand(bool current_shuffle)=0
Send to request shuffle command event with current shuffle value.
virtual std::string play()=0
Request the audio player to play the current content.
virtual std::string stop(bool direct_access=false)=0
Request the audio player to stop the current content.
virtual std::string pause(bool direct_access=false)=0
Request the audio player to pause the current content.
virtual void seek(int msec)=0
Request the audio player to move the current content section.
virtual std::string prev()=0
Request the audio player to play the previous content.
virtual std::string resume(bool direct_access=false)=0
Request the audio player to resume the current content.
virtual std::string requestRepeatCommand(RepeatType current_repeat)=0
Send to request repeat command event with current repeat value.
virtual std::string requestFavoriteCommand(bool current_favorite)=0
Send to request favorite command event with current favorite value.
virtual std::string next()=0
Request the audio player to play the next content.
audioplayer listener interface
Definition: audio_player_interface.hh:76
virtual void repeatChanged(RepeatType repeat, const std::string &dialog_id)=0
The audio player reports to the user the current content's repeat setting changed.
virtual void durationChanged(int duration)=0
The audio player reports the total duration of the content being played to the user.
virtual void favoriteChanged(bool favorite, const std::string &dialog_id)=0
The audio player reports to the user the current content's favorite setting changed.
virtual void mediaStateChanged(AudioPlayerState state, const std::string &dialog_id)=0
Report this to the user when the state of the audio player changes.
virtual void shuffleChanged(bool shuffle, const std::string &dialog_id)=0
The audio player reports to the user the current content's shuffle setting changed.
virtual void mediaEventReport(AudioPlayerEvent event, const std::string &dialog_id)=0
The audio player reports player's event being played to the user.
virtual void requestContentCache(const std::string &key, const std::string &playurl)=0
The audio player request to the user to cache the content if possible.
virtual void positionChanged(int position)=0
The audio player reports to the user the current playing time of the content being played.
virtual bool requestToGetCachedContent(const std::string &key, std::string &filepath)=0
The audio player request to the user to get the cached content.
display handler interface
Definition: display_interface.hh:106
display listener interface
Definition: display_interface.hh:65
capability interface
Definition: capability_interface.hh:81
capability listener interface
Definition: capability_interface.hh:59
RepeatType
RepeatType.
Definition: audio_player_interface.hh:66
AudioPlayerEvent
AudioPlayerEvent.
Definition: audio_player_interface.hh:53
AudioPlayerState
AudioPlayerState.
Definition: audio_player_interface.hh:42