Tizen 2.0 Release
[framework/osp/media.git] / inc / FMediaIPlayerEventListener.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FMediaIPlayerEventListener.h
20  * @brief               This is the header file for the %IPlayerEventListener interface.
21  *
22  * This header file contains the declarations of the %IPlayerEventListener interface.
23  */
24
25 #ifndef _FMEDIA_IPLAYER_EVENT_LISTENER_H_
26 #define _FMEDIA_IPLAYER_EVENT_LISTENER_H_
27
28 #include <FBaseRtIEventListener.h>
29 #include <FMediaPlayerTypes.h>
30
31 namespace Tizen { namespace Media
32 {
33
34 /**
35  * @interface   IPlayerEventListener
36  * @brief                       This interface provides a listener for media playing events.
37  *
38  * @since               2.0
39  *
40  * The %IPlayerEventListener interface specifies the methods used to notify the status of the media player during the media playing events.
41  * The player engine works asynchronously. Therefore, it is important to implement this listener to ensure that the player flows correctly.
42  * When each operation of the Player is completed, an event is generated, and a method from this class is called.
43  *
44  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/media/playing_audio.htm">Playing Audio</a> and
45  <a href="../org.tizen.native.appprogramming/html/guide/media/playing_video.htm">Playing Video</a>.
46  */
47
48 class _OSP_EXPORT_ IPlayerEventListener
49         : virtual public Tizen::Base::Runtime::IEventListener
50 {
51
52 public:
53         /**
54         * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
55         *
56         * @since                2.0
57         */
58         virtual ~IPlayerEventListener(void) {}
59
60         /**
61         *       Called when an audio/video content is opened asynchronously.
62         *
63         *   @since              2.0
64         *
65         *       @param[in]       r                                                                      The cause of the error
66         *       @exception       E_SUCCESS                                                      The method is successful.
67         *       @exception       E_SYSTEM                                                       A system error has occurred.
68         *       @exception       E_CONNECTION_FAILED                            The network connection has failed.
69         *   @exception   E_UNSUPPORTED_FORMAT                           The specified format is not supported.
70         *   @exception   E_UNSUPPORTED_CODEC                            The specified codec is not supported.
71         *       @exception       E_OUT_OF_MEMORY                                        The memory is insufficient.
72         *       @see            Player::OpenFile(), Player::OpenUrl(), Player::OpenBuffer()
73         */
74         virtual void OnPlayerOpened(result r) = 0;
75
76         /**
77         *       Called when the Player reaches the end of the clip.
78         *
79         * @since                2.0
80         */
81         virtual void OnPlayerEndOfClip(void) = 0;
82
83         /**
84         *       Called when the position of the audio/video content moves asynchronously.
85         *
86         * @since                2.0
87         *
88         *       @param[in] r                              The cause of the error
89         *       @exception       E_SUCCESS              The method is successful.
90         *       @exception       E_SYSTEM               A system error has occurred.
91         *       @see                             Player::SeekTo()
92         */
93
94         virtual void OnPlayerSeekCompleted(result r){};
95
96
97         /**
98         *       Called when the streaming data is being buffered.
99         *
100         * @since                2.0
101         *
102         *       @param[in]      percent         The percentage of buffering is completed
103         *       @see                            Player::OpenUrl()
104         */
105         virtual void OnPlayerBuffering(int percent) = 0;
106
107         /**
108         *       Called when an error has occurs while the Player is working.
109         *
110         * @since                2.0
111         *
112         *       @param[in]      r               A player error reason of type ::PlayerErrorReason
113         *       @remarks                        While playing streaming media, the player might throw an error like ::PLAYER_ERROR_CONNECTION_LOST
114         *                               ::PLAYER_ERROR_STREAMING_TIMEOUT, ::PLAYER_ERROR_TRANSPORT or ::PLAYER_ERROR_SERVER. @n
115         *                               If the content includes invalid data, ::PLAYER_ERROR_INVALID_DATA may occur.
116         *       @see                            PlayerErrorReason
117         */
118         virtual void OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason r) = 0;
119
120
121         /**
122          *      Called when the Player is being interrupted by a task of higher priority than the Player.
123          *
124          * @since               2.0
125          */
126         virtual void OnPlayerInterrupted(void) = 0;
127
128         /**
129          *      Called when the interrupting Player has been released.
130          *
131          * @since               2.0
132          */
133         virtual void OnPlayerReleased(void) = 0;
134         /**
135         *       Called when an audio playback focus is changed to another application.
136         *
137         *       @since          2.0
138         *       @remarks        After the audio focus is being changed, the playback is paused or stopped and the state of this instance is changed to PLAYER_STATE_PAUSED or PLAYER_STATE_CLOSED.
139         *       @remarks        An application can play again in the state of PLAYER_STATE_PAUSED but the interaction between device and user needs for playback again. Because there is a possibility of a race condition between applications which try to play without the interaction
140         *       @remarks An application can not play again even in the state of PLAYER_STATE_PAUSED due to the application which has a higher priority.
141         */
142         virtual void OnPlayerAudioFocusChanged(void) {}
143 protected:
144         //
145         // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
146         //
147         // This method is reserved and may change its name at any time without prior notice.
148         //
149         // @since               2.0
150         //
151         virtual void IPlayerEventListener_Reserved1(void) {}
152
153         //
154         // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
155         //
156         // This method is reserved and may change its name at any time without prior notice.
157         //
158         // @since               2.0
159         //
160         virtual void IPlayerEventListener_Reserved2(void) {}
161
162 };
163
164 }}  // Tizen::Media
165
166 #endif