| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 virtual void SetVolume(float leftVolume, float rightVolume) OVERRIDE; | 58 virtual void SetVolume(float leftVolume, float rightVolume) OVERRIDE; |
| 59 virtual int GetVideoWidth() OVERRIDE; | 59 virtual int GetVideoWidth() OVERRIDE; |
| 60 virtual int GetVideoHeight() OVERRIDE; | 60 virtual int GetVideoHeight() OVERRIDE; |
| 61 virtual base::TimeDelta GetCurrentTime() OVERRIDE; | 61 virtual base::TimeDelta GetCurrentTime() OVERRIDE; |
| 62 virtual base::TimeDelta GetDuration() OVERRIDE; | 62 virtual base::TimeDelta GetDuration() OVERRIDE; |
| 63 virtual bool IsPlaying() OVERRIDE; | 63 virtual bool IsPlaying() OVERRIDE; |
| 64 virtual bool CanPause() OVERRIDE; | 64 virtual bool CanPause() OVERRIDE; |
| 65 virtual bool CanSeekForward() OVERRIDE; | 65 virtual bool CanSeekForward() OVERRIDE; |
| 66 virtual bool CanSeekBackward() OVERRIDE; | 66 virtual bool CanSeekBackward() OVERRIDE; |
| 67 virtual bool IsPlayerReady() OVERRIDE; | 67 virtual bool IsPlayerReady() OVERRIDE; |
| 68 virtual GURL GetUrl() OVERRIDE; |
| 69 virtual GURL GetFirstPartyForCookies() OVERRIDE; |
| 68 | 70 |
| 69 protected: | 71 protected: |
| 70 void SetMediaPlayer(jobject j_media_player); | 72 void SetMediaPlayer(jobject j_media_player); |
| 71 void SetMediaPlayerListener(); | 73 void SetMediaPlayerListener(); |
| 72 | 74 |
| 73 // MediaPlayerAndroid implementation. | 75 // MediaPlayerAndroid implementation. |
| 74 virtual void OnVideoSizeChanged(int width, int height) OVERRIDE; | 76 virtual void OnVideoSizeChanged(int width, int height) OVERRIDE; |
| 75 virtual void OnPlaybackComplete() OVERRIDE; | 77 virtual void OnPlaybackComplete() OVERRIDE; |
| 76 virtual void OnMediaInterrupted() OVERRIDE; | 78 virtual void OnMediaInterrupted() OVERRIDE; |
| 77 | 79 |
| 78 virtual void PendingSeekInternal(base::TimeDelta time); | 80 virtual void PendingSeekInternal(base::TimeDelta time); |
| 79 | 81 |
| 80 // Prepare the player for playback, asynchronously. When succeeds, | 82 // Prepare the player for playback, asynchronously. When succeeds, |
| 81 // OnMediaPrepared() will be called. Otherwise, OnMediaError() will | 83 // OnMediaPrepared() will be called. Otherwise, OnMediaError() will |
| 82 // be called with an error type. | 84 // be called with an error type. |
| 83 virtual void Prepare(); | 85 virtual void Prepare(); |
| 84 void OnMediaPrepared(); | 86 void OnMediaPrepared(); |
| 85 | 87 |
| 88 // Create the actual android media player. |
| 89 virtual void CreateMediaPlayer(); |
| 90 |
| 86 private: | 91 private: |
| 87 // Create the actual android media player. | |
| 88 void CreateMediaPlayer(); | |
| 89 | |
| 90 // Set the data source for the media player. | 92 // Set the data source for the media player. |
| 91 void SetDataSource(const std::string& url); | 93 void SetDataSource(const std::string& url); |
| 92 | 94 |
| 93 // Functions that implements media player control. | 95 // Functions that implements media player control. |
| 94 void StartInternal(); | 96 void StartInternal(); |
| 95 void PauseInternal(); | 97 void PauseInternal(); |
| 96 void SeekInternal(base::TimeDelta time); | 98 void SeekInternal(base::TimeDelta time); |
| 97 | 99 |
| 98 // Get allowed operations from the player. | 100 // Get allowed operations from the player. |
| 99 void GetAllowedOperations(); | 101 void GetAllowedOperations(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // Listener object that listens to all the media player events. | 152 // Listener object that listens to all the media player events. |
| 151 MediaPlayerListener listener_; | 153 MediaPlayerListener listener_; |
| 152 | 154 |
| 153 friend class MediaPlayerListener; | 155 friend class MediaPlayerListener; |
| 154 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); | 156 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); |
| 155 }; | 157 }; |
| 156 | 158 |
| 157 } // namespace media | 159 } // namespace media |
| 158 | 160 |
| 159 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ | 161 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ |
| OLD | NEW |