1 // Copyright 2017 Samsung Electronics Inc. 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.
5 #ifndef MEDIA_BASE_TIZEN_MEDIA_PLAYER_INTERFACE_EFL_H_
6 #define MEDIA_BASE_TIZEN_MEDIA_PLAYER_INTERFACE_EFL_H_
8 #include "base/time/time.h"
9 #include "base/tizen/flags.h"
11 #if defined(TIZEN_SOUND_FOCUS)
12 #include "media/base/tizen/sound_focus_manager.h"
21 enum class MediaType {
26 using MediaTypeFlags = base::Flags<MediaType>;
27 DEFINE_OPERATORS_FOR_FLAGS(MediaTypeFlags);
29 class MediaPlayerInterfaceEfl
30 #if defined(TIZEN_SOUND_FOCUS)
31 : public SoundFocusClient
35 virtual ~MediaPlayerInterfaceEfl() = default;
37 virtual int GetPlayerId() const = 0;
39 // Initialize a player to prepare it for accepting playback commands.
40 virtual void Initialize() = 0;
42 // Start playing the media.
43 virtual void Play() = 0;
45 // Pause the player. If |is_media_related_action| is set to |true| it
46 // indicates that the player itself needs to pause to buffer. |false| means
47 // that HTMLMediaElement has requested the player to pause.
48 virtual void Pause(bool is_media_related_action) = 0;
51 virtual void SetRate(double rate) = 0;
53 // Seek to a particular position based on renderer signaling actual seek.
54 // If the player finishes seeking, OnSeekComplete() will be called.
55 virtual void Seek(base::TimeDelta time) = 0;
57 // Set the player audio volume.
58 virtual void SetVolume(double volume) = 0;
60 // Get the current playback position.
61 virtual base::TimeDelta GetCurrentTime() = 0;
63 // The player is now displayed in fullscreen.
64 virtual void EnteredFullscreen() = 0;
66 // The player is back to a normal display mode.
67 virtual void ExitedFullscreen() = 0;
69 // Interface for resource handling
71 // Return the type of media which this player currently plays and needs.
73 virtual MediaTypeFlags GetMediaType() const = 0;
75 // Free all the resources returned by |GetMediaType|.
76 virtual void Suspend() = 0;
78 // Reallocate resources after they have been freed using |Suspend|. The
79 // player needs all the resouces as returned by |GetMediaType|.
80 virtual void Resume() = 0;
82 // Return whether the player is playing or is it in pause state.
83 virtual bool IsPaused() const = 0;
85 // Return whether the player should call seek after resume
86 virtual bool ShouldSeekAfterResume() const = 0;
88 #if defined(TIZEN_VIDEO_HOLE)
89 virtual void SetGeometry(const gfx::RectF&) = 0;
90 virtual void OnWebViewMoved() = 0;
93 #if defined(TIZEN_SOUND_FOCUS)
94 virtual void SetResumePlayingBySFM(bool resume_playing) = 0;
97 virtual double GetStartDate() = 0;
99 virtual bool HasConfigs() const = 0;
101 #if defined(TIZEN_MULTIMEDIA_SUPPORT)
102 // Launch native system volume controller.
103 virtual void LaunchSystemVolumeController() = 0;
111 inline ostream& operator<<(ostream& o, media::MediaType type) {
113 case media::MediaType::Video:
115 case media::MediaType::Audio:
118 return o << "MediaType(" << (int)type << ")";
122 #endif // MEDIA_BASE_TIZEN_MEDIA_PLAYER_INTERFACE_EFL_H_