OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 package org.chromium.media; | 5 package org.chromium.media; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.media.MediaPlayer; | 8 import android.media.MediaPlayer; |
9 | 9 |
10 import org.chromium.base.annotations.CalledByNative; | 10 import org.chromium.base.annotations.CalledByNative; |
(...skipping 14 matching lines...) Expand all Loading... |
25 private static final int MEDIA_ERROR_DECODE = 1; | 25 private static final int MEDIA_ERROR_DECODE = 1; |
26 private static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 2; | 26 private static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 2; |
27 private static final int MEDIA_ERROR_INVALID_CODE = 3; | 27 private static final int MEDIA_ERROR_INVALID_CODE = 3; |
28 private static final int MEDIA_ERROR_SERVER_DIED = 4; | 28 private static final int MEDIA_ERROR_SERVER_DIED = 4; |
29 | 29 |
30 // These values are copied from android media player. | 30 // These values are copied from android media player. |
31 public static final int MEDIA_ERROR_MALFORMED = -1007; | 31 public static final int MEDIA_ERROR_MALFORMED = -1007; |
32 public static final int MEDIA_ERROR_TIMED_OUT = -110; | 32 public static final int MEDIA_ERROR_TIMED_OUT = -110; |
33 | 33 |
34 // Used to determine the class instance to dispatch the native call to. | 34 // Used to determine the class instance to dispatch the native call to. |
35 private long mNativeMediaPlayerListener = 0; | 35 private long mNativeMediaPlayerListener; |
36 private final Context mContext; | 36 private final Context mContext; |
37 | 37 |
38 private MediaPlayerListener(long nativeMediaPlayerListener, Context context)
{ | 38 private MediaPlayerListener(long nativeMediaPlayerListener, Context context)
{ |
39 mNativeMediaPlayerListener = nativeMediaPlayerListener; | 39 mNativeMediaPlayerListener = nativeMediaPlayerListener; |
40 mContext = context; | 40 mContext = context; |
41 } | 41 } |
42 | 42 |
43 @Override | 43 @Override |
44 public boolean onError(MediaPlayer mp, int what, int extra) { | 44 public boolean onError(MediaPlayer mp, int what, int extra) { |
45 int errorType; | 45 int errorType; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 int percent); | 132 int percent); |
133 | 133 |
134 private native void nativeOnMediaPrepared(long nativeMediaPlayerListener); | 134 private native void nativeOnMediaPrepared(long nativeMediaPlayerListener); |
135 | 135 |
136 private native void nativeOnPlaybackComplete(long nativeMediaPlayerListener)
; | 136 private native void nativeOnPlaybackComplete(long nativeMediaPlayerListener)
; |
137 | 137 |
138 private native void nativeOnSeekComplete(long nativeMediaPlayerListener); | 138 private native void nativeOnSeekComplete(long nativeMediaPlayerListener); |
139 | 139 |
140 private native void nativeOnMediaInterrupted(long nativeMediaPlayerListener)
; | 140 private native void nativeOnMediaInterrupted(long nativeMediaPlayerListener)
; |
141 } | 141 } |
OLD | NEW |