blob: 690164c11430d6d8d0ec3740c3be38e84f235a92 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.widget;
18
19import android.content.Context;
20import android.graphics.PixelFormat;
21import android.media.AudioManager;
22import android.os.Handler;
23import android.os.Message;
24import android.util.AttributeSet;
25import android.util.Log;
26import android.view.Gravity;
27import android.view.KeyEvent;
28import android.view.LayoutInflater;
29import android.view.MotionEvent;
30import android.view.View;
31import android.view.ViewGroup;
32import android.view.Window;
33import android.view.WindowManager;
34import android.widget.SeekBar.OnSeekBarChangeListener;
35
36import com.android.internal.policy.PolicyManager;
37
38import java.util.Formatter;
39import java.util.Locale;
40
41/**
42 * A view containing controls for a MediaPlayer. Typically contains the
43 * buttons like "Play/Pause", "Rewind", "Fast Forward" and a progress
44 * slider. It takes care of synchronizing the controls with the state
45 * of the MediaPlayer.
46 * <p>
47 * The way to use this class is to instantiate it programatically.
48 * The MediaController will create a default set of controls
49 * and put them in a window floating above your application. Specifically,
50 * the controls will float above the view specified with setAnchorView().
51 * The window will disappear if left idle for three seconds and reappear
52 * when the user touches the anchor view.
53 * <p>
54 * Functions like show() and hide() have no effect when MediaController
55 * is created in an xml layout.
56 *
57 * MediaController will hide and
58 * show the buttons according to these rules:
59 * <ul>
60 * <li> The "previous" and "next" buttons are hidden until setPrevNextListeners()
61 * has been called
62 * <li> The "previous" and "next" buttons are visible but disabled if
63 * setPrevNextListeners() was called with null listeners
64 * <li> The "rewind" and "fastforward" buttons are shown unless requested
65 * otherwise by using the MediaController(Context, boolean) constructor
66 * with the boolean set to false
67 * </ul>
68 */
69public class MediaController extends FrameLayout {
70
71 private MediaPlayerControl mPlayer;
72 private Context mContext;
73 private View mAnchor;
74 private View mRoot;
75 private WindowManager mWindowManager;
76 private Window mWindow;
77 private View mDecor;
78 private ProgressBar mProgress;
79 private TextView mEndTime, mCurrentTime;
80 private boolean mShowing;
81 private boolean mDragging;
82 private static final int sDefaultTimeout = 3000;
83 private static final int FADE_OUT = 1;
84 private static final int SHOW_PROGRESS = 2;
85 private boolean mUseFastForward;
86 private boolean mFromXml;
87 private boolean mListenersSet;
88 private View.OnClickListener mNextListener, mPrevListener;
89 StringBuilder mFormatBuilder;
90 Formatter mFormatter;
91 private ImageButton mPauseButton;
92 private ImageButton mFfwdButton;
93 private ImageButton mRewButton;
94 private ImageButton mNextButton;
95 private ImageButton mPrevButton;
96
97 public MediaController(Context context, AttributeSet attrs) {
98 super(context, attrs);
99 mRoot = this;
100 mContext = context;
101 mUseFastForward = true;
102 mFromXml = true;
103 }
104
105 @Override
106 public void onFinishInflate() {
107 if (mRoot != null)
108 initControllerView(mRoot);
109 }
110
111 public MediaController(Context context, boolean useFastForward) {
112 super(context);
113 mContext = context;
114 mUseFastForward = useFastForward;
115 initFloatingWindow();
116 }
117
118 public MediaController(Context context) {
119 super(context);
120 mContext = context;
121 mUseFastForward = true;
122 initFloatingWindow();
123 }
124
125 private void initFloatingWindow() {
Christian Mehlmaueref367522010-05-31 23:08:30 +0200126 mWindowManager = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127 mWindow = PolicyManager.makeNewWindow(mContext);
128 mWindow.setWindowManager(mWindowManager, null, null);
129 mWindow.requestFeature(Window.FEATURE_NO_TITLE);
130 mDecor = mWindow.getDecorView();
131 mDecor.setOnTouchListener(mTouchListener);
132 mWindow.setContentView(this);
133 mWindow.setBackgroundDrawableResource(android.R.color.transparent);
134
135 // While the media controller is up, the volume control keys should
136 // affect the media stream type
137 mWindow.setVolumeControlStream(AudioManager.STREAM_MUSIC);
138
139 setFocusable(true);
140 setFocusableInTouchMode(true);
141 setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
142 requestFocus();
143 }
144
145 private OnTouchListener mTouchListener = new OnTouchListener() {
146 public boolean onTouch(View v, MotionEvent event) {
147 if (event.getAction() == MotionEvent.ACTION_DOWN) {
148 if (mShowing) {
149 hide();
150 }
151 }
152 return false;
153 }
154 };
155
156 public void setMediaPlayer(MediaPlayerControl player) {
157 mPlayer = player;
158 updatePausePlay();
159 }
160
161 /**
162 * Set the view that acts as the anchor for the control view.
163 * This can for example be a VideoView, or your Activity's main view.
164 * @param view The view to which to anchor the controller when it is visible.
165 */
166 public void setAnchorView(View view) {
167 mAnchor = view;
168
169 FrameLayout.LayoutParams frameParams = new FrameLayout.LayoutParams(
Romain Guy980a9382010-01-08 15:06:28 -0800170 ViewGroup.LayoutParams.MATCH_PARENT,
171 ViewGroup.LayoutParams.MATCH_PARENT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800172 );
173
174 removeAllViews();
175 View v = makeControllerView();
176 addView(v, frameParams);
177 }
178
179 /**
180 * Create the view that holds the widgets that control playback.
181 * Derived classes can override this to create their own.
182 * @return The controller view.
183 * @hide This doesn't work as advertised
184 */
185 protected View makeControllerView() {
186 LayoutInflater inflate = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
187 mRoot = inflate.inflate(com.android.internal.R.layout.media_controller, null);
188
189 initControllerView(mRoot);
190
191 return mRoot;
192 }
193
194 private void initControllerView(View v) {
195 mPauseButton = (ImageButton) v.findViewById(com.android.internal.R.id.pause);
196 if (mPauseButton != null) {
197 mPauseButton.requestFocus();
198 mPauseButton.setOnClickListener(mPauseListener);
199 }
200
201 mFfwdButton = (ImageButton) v.findViewById(com.android.internal.R.id.ffwd);
202 if (mFfwdButton != null) {
203 mFfwdButton.setOnClickListener(mFfwdListener);
204 if (!mFromXml) {
205 mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
206 }
207 }
208
209 mRewButton = (ImageButton) v.findViewById(com.android.internal.R.id.rew);
210 if (mRewButton != null) {
211 mRewButton.setOnClickListener(mRewListener);
212 if (!mFromXml) {
213 mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
214 }
215 }
216
217 // By default these are hidden. They will be enabled when setPrevNextListeners() is called
218 mNextButton = (ImageButton) v.findViewById(com.android.internal.R.id.next);
219 if (mNextButton != null && !mFromXml && !mListenersSet) {
220 mNextButton.setVisibility(View.GONE);
221 }
222 mPrevButton = (ImageButton) v.findViewById(com.android.internal.R.id.prev);
223 if (mPrevButton != null && !mFromXml && !mListenersSet) {
224 mPrevButton.setVisibility(View.GONE);
225 }
226
227 mProgress = (ProgressBar) v.findViewById(com.android.internal.R.id.mediacontroller_progress);
228 if (mProgress != null) {
229 if (mProgress instanceof SeekBar) {
230 SeekBar seeker = (SeekBar) mProgress;
231 seeker.setOnSeekBarChangeListener(mSeekListener);
232 }
233 mProgress.setMax(1000);
234 }
235
236 mEndTime = (TextView) v.findViewById(com.android.internal.R.id.time);
237 mCurrentTime = (TextView) v.findViewById(com.android.internal.R.id.time_current);
238 mFormatBuilder = new StringBuilder();
239 mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
240
241 installPrevNextListeners();
242 }
243
244 /**
245 * Show the controller on screen. It will go away
246 * automatically after 3 seconds of inactivity.
247 */
248 public void show() {
249 show(sDefaultTimeout);
250 }
251
252 /**
Marco Nelissenc818b142009-08-19 08:32:21 -0700253 * Disable pause or seek buttons if the stream cannot be paused or seeked.
254 * This requires the control interface to be a MediaPlayerControlExt
255 */
256 private void disableUnsupportedButtons() {
257 try {
258 if (mPauseButton != null && !mPlayer.canPause()) {
259 mPauseButton.setEnabled(false);
260 }
261 if (mRewButton != null && !mPlayer.canSeekBackward()) {
262 mRewButton.setEnabled(false);
263 }
264 if (mFfwdButton != null && !mPlayer.canSeekForward()) {
265 mFfwdButton.setEnabled(false);
266 }
267 } catch (IncompatibleClassChangeError ex) {
268 // We were given an old version of the interface, that doesn't have
269 // the canPause/canSeekXYZ methods. This is OK, it just means we
270 // assume the media can be paused and seeked, and so we don't disable
271 // the buttons.
272 }
273 }
274
275 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800276 * Show the controller on screen. It will go away
277 * automatically after 'timeout' milliseconds of inactivity.
278 * @param timeout The timeout in milliseconds. Use 0 to show
279 * the controller until hide() is called.
280 */
281 public void show(int timeout) {
282
283 if (!mShowing && mAnchor != null) {
284 setProgress();
Marco Nelissend701e022009-08-19 15:39:23 -0700285 if (mPauseButton != null) {
286 mPauseButton.requestFocus();
287 }
Marco Nelissenc818b142009-08-19 08:32:21 -0700288 disableUnsupportedButtons();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800289
290 int [] anchorpos = new int[2];
291 mAnchor.getLocationOnScreen(anchorpos);
292
293 WindowManager.LayoutParams p = new WindowManager.LayoutParams();
294 p.gravity = Gravity.TOP;
295 p.width = mAnchor.getWidth();
296 p.height = LayoutParams.WRAP_CONTENT;
297 p.x = 0;
298 p.y = anchorpos[1] + mAnchor.getHeight() - p.height;
299 p.format = PixelFormat.TRANSLUCENT;
300 p.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
Jeff Brown46e75292010-11-10 16:53:45 -0800301 p.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
302 | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800303 p.token = null;
304 p.windowAnimations = 0; // android.R.style.DropDownAnimationDown;
305 mWindowManager.addView(mDecor, p);
306 mShowing = true;
307 }
308 updatePausePlay();
309
310 // cause the progress bar to be updated even if mShowing
311 // was already true. This happens, for example, if we're
312 // paused with the progress bar showing the user hits play.
313 mHandler.sendEmptyMessage(SHOW_PROGRESS);
314
315 Message msg = mHandler.obtainMessage(FADE_OUT);
316 if (timeout != 0) {
317 mHandler.removeMessages(FADE_OUT);
318 mHandler.sendMessageDelayed(msg, timeout);
319 }
320 }
321
322 public boolean isShowing() {
323 return mShowing;
324 }
325
326 /**
327 * Remove the controller from the screen.
328 */
329 public void hide() {
330 if (mAnchor == null)
331 return;
332
333 if (mShowing) {
334 try {
335 mHandler.removeMessages(SHOW_PROGRESS);
336 mWindowManager.removeView(mDecor);
337 } catch (IllegalArgumentException ex) {
338 Log.w("MediaController", "already removed");
339 }
340 mShowing = false;
341 }
342 }
343
344 private Handler mHandler = new Handler() {
345 @Override
346 public void handleMessage(Message msg) {
347 int pos;
348 switch (msg.what) {
349 case FADE_OUT:
350 hide();
351 break;
352 case SHOW_PROGRESS:
353 pos = setProgress();
354 if (!mDragging && mShowing && mPlayer.isPlaying()) {
355 msg = obtainMessage(SHOW_PROGRESS);
356 sendMessageDelayed(msg, 1000 - (pos % 1000));
357 }
358 break;
359 }
360 }
361 };
362
363 private String stringForTime(int timeMs) {
364 int totalSeconds = timeMs / 1000;
365
366 int seconds = totalSeconds % 60;
367 int minutes = (totalSeconds / 60) % 60;
368 int hours = totalSeconds / 3600;
369
370 mFormatBuilder.setLength(0);
371 if (hours > 0) {
372 return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString();
373 } else {
374 return mFormatter.format("%02d:%02d", minutes, seconds).toString();
375 }
376 }
377
378 private int setProgress() {
379 if (mPlayer == null || mDragging) {
380 return 0;
381 }
382 int position = mPlayer.getCurrentPosition();
383 int duration = mPlayer.getDuration();
384 if (mProgress != null) {
385 if (duration > 0) {
386 // use long to avoid overflow
387 long pos = 1000L * position / duration;
388 mProgress.setProgress( (int) pos);
389 }
390 int percent = mPlayer.getBufferPercentage();
391 mProgress.setSecondaryProgress(percent * 10);
392 }
393
394 if (mEndTime != null)
395 mEndTime.setText(stringForTime(duration));
396 if (mCurrentTime != null)
397 mCurrentTime.setText(stringForTime(position));
398
399 return position;
400 }
401
402 @Override
403 public boolean onTouchEvent(MotionEvent event) {
404 show(sDefaultTimeout);
405 return true;
406 }
407
408 @Override
409 public boolean onTrackballEvent(MotionEvent ev) {
410 show(sDefaultTimeout);
411 return false;
412 }
413
414 @Override
415 public boolean dispatchKeyEvent(KeyEvent event) {
416 int keyCode = event.getKeyCode();
Jeff Brown4d396052010-10-29 21:50:21 -0700417 final boolean uniqueDown = event.getRepeatCount() == 0
418 && event.getAction() == KeyEvent.ACTION_DOWN;
419 if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK
420 || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE
421 || keyCode == KeyEvent.KEYCODE_SPACE) {
422 if (uniqueDown) {
423 doPauseResume();
424 show(sDefaultTimeout);
425 if (mPauseButton != null) {
426 mPauseButton.requestFocus();
427 }
Marco Nelissend701e022009-08-19 15:39:23 -0700428 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800429 return true;
Jeff Brown4d396052010-10-29 21:50:21 -0700430 } else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY) {
431 if (uniqueDown && !mPlayer.isPlaying()) {
432 mPlayer.start();
433 updatePausePlay();
434 show(sDefaultTimeout);
435 }
436 return true;
437 } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP
438 || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) {
439 if (uniqueDown && mPlayer.isPlaying()) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 mPlayer.pause();
441 updatePausePlay();
Jeff Brown4d396052010-10-29 21:50:21 -0700442 show(sDefaultTimeout);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800443 }
444 return true;
Jeff Brown4d396052010-10-29 21:50:21 -0700445 } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN
Jeff Brownb0418da2010-11-01 15:24:01 -0700446 || keyCode == KeyEvent.KEYCODE_VOLUME_UP
447 || keyCode == KeyEvent.KEYCODE_VOLUME_MUTE) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800448 // don't show the controls for volume adjustment
449 return super.dispatchKeyEvent(event);
450 } else if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU) {
Jeff Brown4d396052010-10-29 21:50:21 -0700451 if (uniqueDown) {
452 hide();
453 }
The Android Open Source Project10592532009-03-18 17:39:46 -0700454 return true;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800455 }
Jeff Brown4d396052010-10-29 21:50:21 -0700456
457 show(sDefaultTimeout);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800458 return super.dispatchKeyEvent(event);
459 }
460
461 private View.OnClickListener mPauseListener = new View.OnClickListener() {
462 public void onClick(View v) {
463 doPauseResume();
464 show(sDefaultTimeout);
465 }
466 };
467
468 private void updatePausePlay() {
Marco Nelissenc818b142009-08-19 08:32:21 -0700469 if (mRoot == null || mPauseButton == null)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 return;
471
472 if (mPlayer.isPlaying()) {
Marco Nelissenc818b142009-08-19 08:32:21 -0700473 mPauseButton.setImageResource(com.android.internal.R.drawable.ic_media_pause);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800474 } else {
Marco Nelissenc818b142009-08-19 08:32:21 -0700475 mPauseButton.setImageResource(com.android.internal.R.drawable.ic_media_play);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800476 }
477 }
478
479 private void doPauseResume() {
480 if (mPlayer.isPlaying()) {
481 mPlayer.pause();
482 } else {
483 mPlayer.start();
484 }
485 updatePausePlay();
486 }
487
Andreas Huber0de7dcd2009-04-20 14:22:31 -0700488 // There are two scenarios that can trigger the seekbar listener to trigger:
489 //
490 // The first is the user using the touchpad to adjust the posititon of the
491 // seekbar's thumb. In this case onStartTrackingTouch is called followed by
492 // a number of onProgressChanged notifications, concluded by onStopTrackingTouch.
493 // We're setting the field "mDragging" to true for the duration of the dragging
494 // session to avoid jumps in the position in case of ongoing playback.
495 //
496 // The second scenario involves the user operating the scroll ball, in this
497 // case there WON'T BE onStartTrackingTouch/onStopTrackingTouch notifications,
498 // we will simply apply the updated position without suspending regular updates.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 private OnSeekBarChangeListener mSeekListener = new OnSeekBarChangeListener() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 public void onStartTrackingTouch(SeekBar bar) {
501 show(3600000);
Andreas Huber0de7dcd2009-04-20 14:22:31 -0700502
503 mDragging = true;
504
505 // By removing these pending progress messages we make sure
506 // that a) we won't update the progress while the user adjusts
507 // the seekbar and b) once the user is done dragging the thumb
508 // we will post one of these messages to the queue again and
509 // this ensures that there will be exactly one message queued up.
510 mHandler.removeMessages(SHOW_PROGRESS);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800511 }
Andreas Huber0de7dcd2009-04-20 14:22:31 -0700512
513 public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) {
514 if (!fromuser) {
515 // We're not interested in programmatically generated changes to
516 // the progress bar's position.
517 return;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800518 }
Andreas Huber0de7dcd2009-04-20 14:22:31 -0700519
520 long duration = mPlayer.getDuration();
521 long newposition = (duration * progress) / 1000L;
522 mPlayer.seekTo( (int) newposition);
523 if (mCurrentTime != null)
524 mCurrentTime.setText(stringForTime( (int) newposition));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800525 }
Andreas Huber0de7dcd2009-04-20 14:22:31 -0700526
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800527 public void onStopTrackingTouch(SeekBar bar) {
528 mDragging = false;
529 setProgress();
530 updatePausePlay();
531 show(sDefaultTimeout);
Andreas Huber0de7dcd2009-04-20 14:22:31 -0700532
533 // Ensure that progress is properly updated in the future,
534 // the call to show() does not guarantee this because it is a
535 // no-op if we are already showing.
536 mHandler.sendEmptyMessage(SHOW_PROGRESS);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 }
538 };
539
540 @Override
541 public void setEnabled(boolean enabled) {
542 if (mPauseButton != null) {
543 mPauseButton.setEnabled(enabled);
544 }
545 if (mFfwdButton != null) {
546 mFfwdButton.setEnabled(enabled);
547 }
548 if (mRewButton != null) {
549 mRewButton.setEnabled(enabled);
550 }
551 if (mNextButton != null) {
552 mNextButton.setEnabled(enabled && mNextListener != null);
553 }
554 if (mPrevButton != null) {
555 mPrevButton.setEnabled(enabled && mPrevListener != null);
556 }
557 if (mProgress != null) {
558 mProgress.setEnabled(enabled);
559 }
Marco Nelissenc818b142009-08-19 08:32:21 -0700560 disableUnsupportedButtons();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800561 super.setEnabled(enabled);
562 }
563
564 private View.OnClickListener mRewListener = new View.OnClickListener() {
565 public void onClick(View v) {
566 int pos = mPlayer.getCurrentPosition();
567 pos -= 5000; // milliseconds
568 mPlayer.seekTo(pos);
569 setProgress();
570
571 show(sDefaultTimeout);
572 }
573 };
574
575 private View.OnClickListener mFfwdListener = new View.OnClickListener() {
576 public void onClick(View v) {
577 int pos = mPlayer.getCurrentPosition();
578 pos += 15000; // milliseconds
579 mPlayer.seekTo(pos);
580 setProgress();
581
582 show(sDefaultTimeout);
583 }
584 };
585
586 private void installPrevNextListeners() {
587 if (mNextButton != null) {
588 mNextButton.setOnClickListener(mNextListener);
589 mNextButton.setEnabled(mNextListener != null);
590 }
591
592 if (mPrevButton != null) {
593 mPrevButton.setOnClickListener(mPrevListener);
594 mPrevButton.setEnabled(mPrevListener != null);
595 }
596 }
597
598 public void setPrevNextListeners(View.OnClickListener next, View.OnClickListener prev) {
599 mNextListener = next;
600 mPrevListener = prev;
601 mListenersSet = true;
602
603 if (mRoot != null) {
604 installPrevNextListeners();
605
606 if (mNextButton != null && !mFromXml) {
607 mNextButton.setVisibility(View.VISIBLE);
608 }
609 if (mPrevButton != null && !mFromXml) {
610 mPrevButton.setVisibility(View.VISIBLE);
611 }
612 }
613 }
614
615 public interface MediaPlayerControl {
616 void start();
617 void pause();
618 int getDuration();
619 int getCurrentPosition();
620 void seekTo(int pos);
621 boolean isPlaying();
622 int getBufferPercentage();
Marco Nelissenc818b142009-08-19 08:32:21 -0700623 boolean canPause();
624 boolean canSeekBackward();
625 boolean canSeekForward();
626 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800627}