forked from bilibili/ijkplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIMediaPlayer.java
141 lines (96 loc) · 4.43 KB
/
IMediaPlayer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
package tv.danmaku.ijk.media.player;
import java.io.IOException;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.view.Surface;
import android.view.SurfaceHolder;
public interface IMediaPlayer {
/*
* Do not change these values without updating their counterparts in native
*/
public static final int MEDIA_INFO_UNKNOWN = 1;
public static final int MEDIA_INFO_STARTED_AS_NEXT = 2;
public static final int MEDIA_INFO_VIDEO_RENDERING_START = 3;
public static final int MEDIA_INFO_VIDEO_TRACK_LAGGING = 700;
public static final int MEDIA_INFO_BUFFERING_START = 701;
public static final int MEDIA_INFO_BUFFERING_END = 702;
public static final int MEDIA_INFO_BAD_INTERLEAVING = 800;
public static final int MEDIA_INFO_NOT_SEEKABLE = 801;
public static final int MEDIA_INFO_METADATA_UPDATE = 802;
public static final int MEDIA_INFO_TIMED_TEXT_ERROR = 900;
public static final int MEDIA_ERROR_UNKNOWN = 1;
public static final int MEDIA_ERROR_SERVER_DIED = 100;
public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200;
public static final int MEDIA_ERROR_IO = -1004;
public static final int MEDIA_ERROR_MALFORMED = -1007;
public static final int MEDIA_ERROR_UNSUPPORTED = -1010;
public static final int MEDIA_ERROR_TIMED_OUT = -110;
public abstract void setDisplay(SurfaceHolder sh);
public abstract void setDataSource(String path) throws IOException,
IllegalArgumentException, SecurityException, IllegalStateException;
public abstract String getDataSource();
public abstract void prepareAsync() throws IllegalStateException;
public abstract void start() throws IllegalStateException;
public abstract void stop() throws IllegalStateException;
public abstract void pause() throws IllegalStateException;
public abstract void setScreenOnWhilePlaying(boolean screenOn);
public abstract int getVideoWidth();
public abstract int getVideoHeight();
public abstract boolean isPlaying();
public abstract void seekTo(long msec) throws IllegalStateException;
public abstract long getCurrentPosition();
public abstract long getDuration();
public abstract void release();
public abstract void reset();
public abstract void setVolume(float leftVolume, float rightVolume);
public abstract MediaInfo getMediaInfo();
public abstract void setLogEnabled(boolean enable);
public abstract boolean isPlayable();
public abstract void setOnPreparedListener(OnPreparedListener listener);
public abstract void setOnCompletionListener(OnCompletionListener listener);
public abstract void setOnBufferingUpdateListener(
OnBufferingUpdateListener listener);
public abstract void setOnSeekCompleteListener(
OnSeekCompleteListener listener);
public abstract void setOnVideoSizeChangedListener(
OnVideoSizeChangedListener listener);
public abstract void setOnErrorListener(OnErrorListener listener);
public abstract void setOnInfoListener(OnInfoListener listener);
/*--------------------
* Listeners
*/
public static interface OnPreparedListener {
void onPrepared(IMediaPlayer mp);
}
public static interface OnCompletionListener {
void onCompletion(IMediaPlayer mp);
}
public static interface OnBufferingUpdateListener {
void onBufferingUpdate(IMediaPlayer mp, int percent);
}
public static interface OnSeekCompleteListener {
public void onSeekComplete(IMediaPlayer mp);
}
public static interface OnVideoSizeChangedListener {
public void onVideoSizeChanged(IMediaPlayer mp, int width, int height,
int sar_num, int sar_den);
}
public static interface OnErrorListener {
boolean onError(IMediaPlayer mp, int what, int extra);
}
public static interface OnInfoListener {
boolean onInfo(IMediaPlayer mp, int what, int extra);
}
/*--------------------
* Optional
*/
public abstract void setAudioStreamType(int streamtype);
public abstract void setKeepInBackground(boolean keepInBackground);
public abstract int getVideoSarNum();
public abstract int getVideoSarDen();
@Deprecated
public abstract void setWakeMode(Context context, int mode);
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public abstract void setSurface(Surface surface);
}