AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
ExternalMediaAdapterHandlerInterface.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. 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  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_ACSDKEXTERNALMEDIAPLAYERINTERFACES_INCLUDE_ACSDKEXTERNALMEDIAPLAYERINTERFACES_EXTERNALMEDIAADAPTERHANDLERINTERFACE_H_
17 #define ALEXA_CLIENT_SDK_ACSDKEXTERNALMEDIAPLAYERINTERFACES_INCLUDE_ACSDKEXTERNALMEDIAPLAYERINTERFACES_EXTERNALMEDIAADAPTERHANDLERINTERFACE_H_
18 
19 #include <chrono>
20 #include <string>
21 #include <vector>
22 
25 
28 
29 namespace alexaClientSDK {
30 namespace acsdkExternalMediaPlayerInterfaces {
31 
35 class ExternalMediaPlayerInterface;
36 
48 public:
53  explicit ExternalMediaAdapterHandlerInterface(const std::string& name);
54 
58  virtual ~ExternalMediaAdapterHandlerInterface() = default;
59 
61  struct PlayParams {
63  std::string localPlayerId;
65  std::string playContextToken;
67  int64_t index;
69  std::chrono::milliseconds offset;
71  std::string skillToken;
73  std::string playbackSessionId;
77  bool preload;
80 #ifdef MEDIA_PORTABILITY_ENABLED
81  std::string mediaSessionId;
84  std::string correlationToken;
85 #endif
86  std::string playbackTarget;
88 
105  const std::string& localPlayerId,
106  const std::string& playContextToken,
107  int64_t index,
108  std::chrono::milliseconds offset,
109  const std::string& skillToken,
110  const std::string& playbackSessionId,
111  Navigation navigation,
112  bool preload,
114 #ifdef MEDIA_PORTABILITY_ENABLED
115  const std::string& mediaSessionId,
116  const std::string& correlationToken,
117 #endif
118  const std::string& playbackTarget) :
119  localPlayerId{localPlayerId},
120  playContextToken{playContextToken},
121  index{index},
122  offset{offset},
123  skillToken{skillToken},
124  playbackSessionId{playbackSessionId},
125  navigation{navigation},
126  preload{preload},
127  playRequestor(playRequestor),
128 #ifdef MEDIA_PORTABILITY_ENABLED
129  mediaSessionId{mediaSessionId},
130  correlationToken{correlationToken},
131 #endif
132  playbackTarget{playbackTarget} {
133  }
134  };
135 
145  virtual std::vector<PlayerInfo> updatePlayerInfo(const std::vector<PlayerInfo>& playerList) = 0;
146 
157  virtual bool login(
158  const std::string& localPlayerId,
159  const std::string& accessToken,
160  const std::string& userName,
161  bool forceLogin,
162  std::chrono::milliseconds tokenRefreshInterval) = 0;
163 
169  virtual bool logout(const std::string& localPlayerId) = 0;
170 
177  virtual bool play(const PlayParams& params) = 0;
178 
187  virtual bool playControl(
188  const std::string& localPlayerId,
190 #ifdef MEDIA_PORTABILITY_ENABLED
193  const std::string& mediaSessionId,
194  const std::string& correlationToken,
195 #endif
196  const std::string& playbackTarget) = 0;
197 
205  virtual bool seek(const std::string& localPlayerId, std::chrono::milliseconds offset) = 0;
206 
214  virtual bool adjustSeek(const std::string& localPlayerId, std::chrono::milliseconds deltaOffset) = 0;
215 
222  virtual acsdkExternalMediaPlayerInterfaces::AdapterState getAdapterState(const std::string& localPlayerId) = 0;
223 
229  virtual std::vector<acsdkExternalMediaPlayerInterfaces::AdapterState> getAdapterStates() = 0;
230 
237  virtual std::chrono::milliseconds getOffset(const std::string& localPlayerId) = 0;
238 
244  virtual void setExternalMediaPlayer(const std::shared_ptr<ExternalMediaPlayerInterface> externalMediaPlayer) = 0;
245 };
246 
248  alexaClientSDK::avsCommon::utils::RequiresShutdown{name} {
249 }
250 
251 } // namespace acsdkExternalMediaPlayerInterfaces
252 } // namespace alexaClientSDK
253 
254 #endif // ALEXA_CLIENT_SDK_ACSDKEXTERNALMEDIAPLAYERINTERFACES_INCLUDE_ACSDKEXTERNALMEDIAPLAYERINTERFACES_EXTERNALMEDIAADAPTERHANDLERINTERFACE_H_
std::string playContextToken
Play context token for specifying what to play.
Definition: ExternalMediaAdapterHandlerInterface.h:65
int64_t index
Index for track.
Definition: ExternalMediaAdapterHandlerInterface.h:67
virtual std::chrono::milliseconds getOffset(const std::string &localPlayerId)=0
RequestType
Definition: ExternalMediaAdapterInterface.h:32
std::string localPlayerId
Local player id to play with.
Definition: ExternalMediaAdapterHandlerInterface.h:63
Navigation
Definition: ExternalMediaAdapterInterface.h:256
virtual std::vector< acsdkExternalMediaPlayerInterfaces::AdapterState > getAdapterStates()=0
virtual std::vector< PlayerInfo > updatePlayerInfo(const std::vector< PlayerInfo > &playerList)=0
bool preload
Whether or not to preload first.
Definition: ExternalMediaAdapterHandlerInterface.h:77
const std::string & name() const
Definition: RequiresShutdown.cpp:131
virtual bool seek(const std::string &localPlayerId, std::chrono::milliseconds offset)=0
Definition: ExternalMediaAdapterInterface.h:501
std::string playbackTarget
Playback target to play on.
Definition: ExternalMediaAdapterHandlerInterface.h:87
virtual bool adjustSeek(const std::string &localPlayerId, std::chrono::milliseconds deltaOffset)=0
PlayParams is a struct that contains the parameters for the play method.
Definition: ExternalMediaAdapterHandlerInterface.h:61
std::string playbackSessionId
Playback session id for identifying the session.
Definition: ExternalMediaAdapterHandlerInterface.h:73
std::chrono::milliseconds offset
Offset to play from.
Definition: ExternalMediaAdapterHandlerInterface.h:69
virtual acsdkExternalMediaPlayerInterfaces::AdapterState getAdapterState(const std::string &localPlayerId)=0
ExternalMediaAdapterHandlerInterface(const std::string &name)
Definition: ExternalMediaAdapterHandlerInterface.h:247
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
std::string skillToken
Associated skillToken.
Definition: ExternalMediaAdapterHandlerInterface.h:71
virtual void setExternalMediaPlayer(const std::shared_ptr< ExternalMediaPlayerInterface > externalMediaPlayer)=0
virtual bool playControl(const std::string &localPlayerId, acsdkExternalMediaPlayerInterfaces::RequestType requestType, const std::string &playbackTarget)=0
alexaClientSDK::avsCommon::avs::PlayRequestor playRequestor
PlayRequestor for indicating who requested playback.
Definition: ExternalMediaAdapterHandlerInterface.h:79
Definition: PlayRequestor.h:29
Navigation navigation
Navigation for indicating foreground or not.
Definition: ExternalMediaAdapterHandlerInterface.h:75
PlayParams(const std::string &localPlayerId, const std::string &playContextToken, int64_t index, std::chrono::milliseconds offset, const std::string &skillToken, const std::string &playbackSessionId, Navigation navigation, bool preload, const alexaClientSDK::avsCommon::avs::PlayRequestor &playRequestor, const std::string &playbackTarget)
Definition: ExternalMediaAdapterHandlerInterface.h:104
virtual bool login(const std::string &localPlayerId, const std::string &accessToken, const std::string &userName, bool forceLogin, std::chrono::milliseconds tokenRefreshInterval)=0

AlexaClientSDK 1.26.0 - Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0