Pepper_47_C++_interfaces
media_events_listener_samsung.h
Go to the documentation of this file.
1 // Copyright (c) 2016 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef PPAPI_CPP_SAMSUNG_MEDIA_EVENTS_LISTENER_SAMSUNG_H_
6 #define PPAPI_CPP_SAMSUNG_MEDIA_EVENTS_LISTENER_SAMSUNG_H_
7 
8 #include "ppapi/c/pp_resource.h"
9 #include "ppapi/c/samsung/ppp_media_player_samsung.h"
10 
11 /// @file
12 /// This file defines a <code>MediaEventsListener_Samsung</code> type which
13 /// allows plugin to receive player or playback related events.
14 namespace pp {
15 
16 class MediaPlayer_Samsung;
17 
18 /// Listener for receiving player or playback related events.
19 ///
20 /// All event methods will be called on the same thread. If this class was
21 /// created on a thread with a running message loop, the event methods will run
22 /// on this thread. Otherwise, they will run on the main thread.
24  public:
26 
27  /// Event sent periodically during clip playback and indicates playback
28  /// progress.
29  ///
30  /// Event will be sent at least twice per second.
31  ///
32  /// @param[in] time current media time.
33  virtual void OnTimeUpdate(PP_TimeTicks time);
34 
35  /// Played clip has ended.
36  virtual void OnEnded();
37 
38  /// Error during playback has occurred.
39  ///
40  /// @param[in] error An error code signalizing type of occurred error.
41  virtual void OnError(PP_MediaPlayerError error);
42 
43  protected:
44  /// The default constructor which creates listener not attached
45  /// to the player
47 
48  /// Constructor which creates listener attached to the |player|.
50 
51  /// Attaches listener to the |player|.
52  void AttachTo(MediaPlayer_Samsung* player);
53 
54  private:
55  void Detach();
56  PP_Resource player_;
57 
58  // Disallow copy and assign
61 };
62 
63 } // namespace pp
64 
65 #endif // PPAPI_CPP_SAMSUNG_MEDIA_EVENTS_LISTENER_SAMSUNG_H_
virtual void OnTimeUpdate(PP_TimeTicks time)
void AttachTo(MediaPlayer_Samsung *player)
Attaches listener to the |player|.
virtual void OnError(PP_MediaPlayerError error)
virtual void OnEnded()
Played clip has ended.