Pepper_47_C++_interfaces
buffering_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_BUFFERING_LISTENER_SAMSUNG_H_
6 #define PPAPI_CPP_SAMSUNG_BUFFERING_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>BufferingListener_Samsung</code> type which
13 /// allows plugin to receive initial media buffering events.
14 namespace pp {
15 
16 class MediaPlayer_Samsung;
17 
18 /// Listener for receiving initial media buffering related events, sent
19 /// before playback can be started.
20 ///
21 /// Those event can be used by the application to show buffering progress bar
22 /// to the user.
23 ///
24 /// Those events are sent only when media buffering is managed by the player
25 /// implementation (see <code>URLDataSource_Samsung</code>), not by the user
26 /// (see <code>ESDataSource_Samsung</code>).
27 ///
28 /// All event methods will be called on the same thread. If this class was
29 /// created on a thread with a running message loop, the event methods will run
30 /// on this thread. Otherwise, they will run on the main thread.
32  public:
34 
35  /// Initial media buffering has been started by the player.
36  virtual void OnBufferingStart();
37 
38  /// Initial buffering in progress.
39  ///
40  /// @param[in] percent Indicates how much of the initial data has been
41  /// buffered by the player.
42  virtual void OnBufferingProgress(uint32_t percent);
43 
44  /// Initial media buffering has been completed by the player, after that
45  /// event playback might be started.
46  virtual void OnBufferingComplete();
47 
48  protected:
49  /// The default constructor which creates listener not attached
50  /// to the player
52 
53  /// Constructor which creates listener attached to the |player|.
55 
56  /// Attaches listener to the |player|.
57  void AttachTo(MediaPlayer_Samsung* player);
58 
59  private:
60  void Detach();
61  PP_Resource player_;
62 
63  // Disallow copy and assign
66 };
67 
68 } // namespace pp
69 
70 #endif // PPAPI_CPP_SAMSUNG_BUFFERING_LISTENER_SAMSUNG_H_
virtual void OnBufferingStart()
Initial media buffering has been started by the player.
void AttachTo(MediaPlayer_Samsung *player)
Attaches listener to the |player|.
virtual void OnBufferingProgress(uint32_t percent)