list) {
19 | this.list = list;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/demo/src/main/java/com/videolist/yyl/ui/DemoActivity.java:
--------------------------------------------------------------------------------
1 | package com.videolist.yyl.ui;
2 |
3 | import android.content.pm.ActivityInfo;
4 | import android.content.res.Configuration;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 |
8 | import com.videolist.yyl.R;
9 | import com.yyl.videolist.utils.V;
10 | import com.yyl.videolist.video.VlcMediaView;
11 |
12 | public class DemoActivity extends AppCompatActivity {
13 | VlcMediaView vlcVideoView;
14 | String path = "http://img1.peiyinxiu.com/2014121211339c64b7fb09742e2c.mp4";
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_demo);
20 | vlcVideoView = V.findV(this, R.id.demo_video);
21 | vlcVideoView.onAttached(this);
22 | vlcVideoView.playVideo(path);
23 | getSupportActionBar().setTitle("Demo VideoPlayer");
24 | }
25 | @Override
26 | public void onConfigurationChanged(Configuration newConfig) {
27 | super.onConfigurationChanged(newConfig);
28 | if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
29 | getSupportActionBar().hide();
30 | } else {
31 | getSupportActionBar().show();
32 | }
33 | }
34 | @Override
35 | public void onBackPressed() {
36 | if (vlcVideoView.onBackPressed(this)) return;
37 | super.onBackPressed();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/demo/src/main/java/com/videolist/yyl/ui/ListVideoActivity.java:
--------------------------------------------------------------------------------
1 | package com.videolist.yyl.ui;
2 |
3 | import android.content.Context;
4 | import android.content.pm.ActivityInfo;
5 | import android.content.res.Configuration;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.os.Bundle;
8 | import android.support.v7.widget.RecyclerView;
9 |
10 | import com.google.gson.Gson;
11 | import com.videolist.yyl.R;
12 | import com.videolist.yyl.dao.VideoListData;
13 | import com.videolist.yyl.view.VideoAdapter;
14 | import com.yyl.videolist.video.VlcMediaView;
15 |
16 | import java.io.BufferedReader;
17 | import java.io.InputStreamReader;
18 |
19 | public class ListVideoActivity extends AppCompatActivity {
20 |
21 | VideoAdapter videoAdapter;
22 | RecyclerView recyclerView;
23 | VlcMediaView vlcVideoView;
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_list_video);
29 | recyclerView = ((RecyclerView) findViewById(R.id.videoList));
30 | vlcVideoView = ((VlcMediaView) findViewById(R.id.vlc_videoView));
31 | videoAdapter = new VideoAdapter(vlcVideoView);
32 | recyclerView.setAdapter(videoAdapter);
33 |
34 |
35 | vlcVideoView.onAttached(this);
36 | vlcVideoView.onAttached(recyclerView);
37 | initData();
38 | getSupportActionBar().setTitle("recycleView列表视频悬浮播放 无入侵写法");
39 | }
40 |
41 | @Override
42 | public void onConfigurationChanged(Configuration newConfig) {
43 | super.onConfigurationChanged(newConfig);
44 | if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
45 | getSupportActionBar().hide();
46 | } else {
47 | getSupportActionBar().show();
48 | }
49 | }
50 |
51 | @Override
52 | public void onBackPressed() {
53 | if (vlcVideoView.onBackPressed(this)) return;
54 | super.onBackPressed();
55 | }
56 |
57 | private void initData() {
58 | String data = readTextFileFromRawResourceId(this, R.raw.video_list);
59 | VideoListData data1 = new Gson().fromJson(data, VideoListData.class);
60 | videoAdapter.refresh(data1.getList());
61 | }
62 |
63 | public String readTextFileFromRawResourceId(Context context, int resourceId) {
64 | StringBuilder builder = new StringBuilder();
65 |
66 | BufferedReader reader = new BufferedReader(new InputStreamReader(context.getResources().openRawResource(
67 | resourceId)));
68 |
69 | try {
70 | for (String line = reader.readLine(); line != null; line = reader.readLine()) {
71 | builder.append(line).append("\n");
72 | }
73 | } catch (Exception e) {
74 | throw new RuntimeException(e);
75 | }
76 |
77 | return builder.toString();
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/demo/src/main/java/com/videolist/yyl/ui/MiniVideoActivity.java:
--------------------------------------------------------------------------------
1 | package com.videolist.yyl.ui;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.videolist.yyl.R;
7 |
8 | public class MiniVideoActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_mini_video);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/demo/src/main/java/com/videolist/yyl/ui/OthereActivity.java:
--------------------------------------------------------------------------------
1 | package com.videolist.yyl.ui;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.videolist.yyl.R;
7 |
8 | public class OthereActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_othere);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/demo/src/main/java/com/videolist/yyl/ui/RTSPActivity.java:
--------------------------------------------------------------------------------
1 | package com.videolist.yyl.ui;
2 |
3 | import android.app.ProgressDialog;
4 | import android.net.Uri;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.util.Log;
8 | import android.view.View;
9 | import android.widget.EditText;
10 |
11 | import com.videolist.yyl.R;
12 | import com.yyl.videolist.MyVideoView;
13 | import com.yyl.videolist.utils.V;
14 |
15 | import org.videolan.libvlc.LibVLC;
16 | import org.videolan.libvlc.Media;
17 | import org.videolan.vlc.listener.MediaListenerEvent;
18 | import org.videolan.vlc.util.VLCOptions;
19 |
20 | import java.util.ArrayList;
21 |
22 | /**
23 | * 电视直播
24 | * 请至官方网站查看更多设置
25 | * https://wiki.videolan.org/VLC_command-line_help/
26 | */
27 | public class RTSPActivity extends AppCompatActivity implements MediaListenerEvent {
28 | MyVideoView videoView;
29 | String path1 = "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8";//苹果的m3u8
30 | String path2 = "rtmp://live.hkstv.hk.lxdns.com/live/hks";// h264的地址
31 | String path3 = "rtsp://218.204.223.237:554/live/1/66251FC11353191F/e7ooqwcfbqjoo80j.sdp";//h263地址
32 |
33 | ProgressDialog progressDialog;
34 | EditText editText;
35 |
36 | @Override
37 | protected void onCreate(Bundle savedInstanceState) {
38 | super.onCreate(savedInstanceState);
39 | setContentView(R.layout.activity_rtsp);
40 | editText = V.findV(this, R.id.url_test);
41 | progressDialog = new ProgressDialog(this);
42 | videoView = V.findV(this, R.id.rtsp_video);
43 | videoView.setMediaListenerEvent(this);
44 | videoView.startPlay(path3);
45 | editText.setText(path2);
46 | getSupportActionBar().setTitle("RTSP,电视直播,m3u8");
47 | }
48 |
49 | @Override
50 | protected void onStop() {
51 | super.onStop();
52 | videoView.onStop();
53 | }
54 |
55 | public void test_start(View view) {
56 |
57 | videoView.startPlay(editText.getText().toString());
58 | }
59 |
60 | /**
61 | * 尝试秒开网络流但是秒开后马上就卡那几秒
62 | *
有用的上的自己慢慢调吧
63 | * 推荐硬解会好点 手机烂的就算了
64 | */
65 | public void test2() {
66 | // videoView.onStop();
67 | ArrayList libOptions = VLCOptions.getLibOptions(getApplicationContext());
68 | // libOptions.add("--rtsp-tcp");
69 | libOptions.add("--rtsp-http");
70 | libOptions.add("--rtsp-frame-buffer-size=1024");// --rtsp-frame-buffer-size=
71 | //libOptions.add("--rtsp-timeout=1");
72 | libOptions.add("--ipv4-timeout=5");
73 | libOptions.add("--network-caching=500");
74 | libOptions.add("--androidwindow-chroma");
75 | libOptions.add("RV16");
76 | LibVLC libVLC = new LibVLC(getApplicationContext(), libOptions);
77 | // videoView.setMediaPlayer(libVLC);
78 |
79 | final Media media = new Media(libVLC, Uri.parse(path2));
80 | media.setHWDecoderEnabled(true, true);
81 | media.parseAsync(Media.Parse.FetchNetwork, 10 * 1000);
82 | media.addOption(":file-caching=500");
83 | media.addOption(":network-caching=500");
84 | videoView.setMedia(media);
85 | videoView.startPlay(path2);
86 |
87 | }
88 |
89 | long time;
90 |
91 | @Override
92 | public void eventBuffing(int event, float buffing) {
93 |
94 | }
95 |
96 | @Override
97 | public void eventPlayInit(boolean openingVideo) {
98 | if (!openingVideo) {
99 | time = System.currentTimeMillis();
100 | } else {
101 | long useTime = System.currentTimeMillis() - time;
102 | Log.i("yyl", "打开地址时间=" + useTime);
103 | }
104 | if (openingVideo)
105 | progressDialog.show();
106 | }
107 |
108 |
109 | @Override
110 | public void eventStop(boolean isPlayError) {
111 | progressDialog.hide();
112 | }
113 |
114 | @Override
115 | public void eventError(int error, boolean show) {
116 | progressDialog.hide();
117 | }
118 |
119 | @Override
120 | public void eventPlay(boolean isPlaying) {
121 | if (isPlaying) {
122 | long useTime = System.currentTimeMillis() - time;
123 | Log.i("yyl", "延迟时间=" + useTime);
124 | progressDialog.hide();
125 | }
126 | }
127 |
128 |
129 | }
130 |
--------------------------------------------------------------------------------
/demo/src/main/java/com/videolist/yyl/ui/ViewPageListActivity.java:
--------------------------------------------------------------------------------
1 | package com.videolist.yyl.ui;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.videolist.yyl.R;
7 |
8 | public class ViewPageListActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_view_page_list);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/demo/src/main/java/com/videolist/yyl/utils/DialogUtils.java:
--------------------------------------------------------------------------------
1 | package com.videolist.yyl.utils;
2 |
3 | import android.content.Context;
4 |
5 | import com.afollestad.materialdialogs.MaterialDialog;
6 |
7 | /**
8 | * Created by Administrator on 2016/1/26/026.
9 | */
10 | public class DialogUtils {
11 |
12 |
13 | public static MaterialDialog showDialog(Context context, String title, String message, MaterialDialog.SingleButtonCallback singleButtonCallback) {
14 | return new MaterialDialog.Builder(context)
15 | .title(title)
16 | .content(message)
17 | .positiveText("确定").negativeText("取消").onPositive(singleButtonCallback).onNegative(singleButtonCallback).show();
18 | }
19 |
20 | public static MaterialDialog show3GDialog(Context context, MaterialDialog.SingleButtonCallback singleButtonCallback) {
21 | return showDialog(context, "提示", "当前是3G网络是否继续播放", singleButtonCallback);
22 | }
23 |
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/demo/src/main/java/com/videolist/yyl/view/MediaControllerFull.java:
--------------------------------------------------------------------------------
1 | package com.videolist.yyl.view;
2 |
3 | import android.view.View;
4 | import android.view.animation.Animation;
5 | import android.view.animation.AnimationUtils;
6 | import android.widget.ImageButton;
7 | import android.widget.LinearLayout;
8 | import android.widget.SeekBar;
9 | import android.widget.TextView;
10 |
11 | import com.videolist.yyl.R;
12 | import com.yyl.videolist.listeners.FullScreenControl;
13 | import com.yyl.videolist.listeners.VideoViewControllerListeners;
14 | import com.yyl.videolist.utils.LogUtils;
15 | import com.yyl.videolist.utils.StringUtils;
16 | import com.yyl.videolist.video.MySensorListener;
17 |
18 | import org.videolan.vlc.listener.MediaPlayerControl;
19 |
20 | import butterknife.BindView;
21 | import butterknife.ButterKnife;
22 | import butterknife.OnClick;
23 |
24 |
25 | /**
26 | * Created by yyl on 2016/2/16/016.
27 | *
28 | * 全屏播放器 底布局
29 | */
30 | public class MediaControllerFull implements VideoViewControllerListeners {
31 |
32 | public MediaPlayerControl mPlayer;
33 |
34 | @BindView(R.id.mediacontroller_back)
35 | ImageButton mediacontrollerBack;
36 | @BindView(R.id.mediacontroller_file_name)
37 | TextView mediacontrollerFileName;
38 | @BindView(R.id.mediacontroller_projection)
39 | ImageButton mediacontrollerProjection;
40 | @BindView(R.id.mediacontroller_lock)
41 | ImageButton mediacontrollerLock;
42 | @BindView(R.id.mediacontroller_share)
43 | ImageButton mediacontrollerShare;
44 |
45 | @BindView(R.id.mediacontroller_time_current)
46 | TextView mCurrentTime;
47 |
48 | @BindView(R.id.mediacontroller_playmode)
49 | ImageButton loopButton;
50 | @BindView(R.id.mediacontroller_last)
51 | ImageButton mediacontrollerLast;
52 | @BindView(R.id.mediacontroller_play_pause)
53 | ImageButton mPauseButton;
54 | @BindView(R.id.mediacontroller_next)
55 | ImageButton mediacontrollerNext;
56 | @BindView(R.id.mediacontroller_mirror)
57 | TextView mediacontrollerMirror;
58 |
59 | @BindView(R.id.mediacontroller_speed_change)
60 | TextView mediacontroller_speed_change;
61 |
62 | @BindView(R.id.mediacontroller_seekbar)
63 | SeekBar mProgress;
64 |
65 |
66 | @BindView(R.id.mediacontroller_tag)
67 | LinearLayout mediacontrollerTag;
68 |
69 | @BindView(R.id.mediacontroller_down_layout)
70 | View down_layout;
71 |
72 | @BindView(R.id.mediacontroller_up_layout)
73 | View upLayout;
74 |
75 |
76 | @BindView(R.id.mediacontroller_conter_bg)
77 | View conterLayout;
78 | private FullScreenControl fullScreenControl;
79 |
80 |
81 | private long mDuration;
82 | private boolean mDragging;
83 | private boolean mInstantSeeking = false;
84 |
85 | public void setLoopState(boolean loopState) {
86 |
87 | }
88 |
89 | public void setFileName(String name) {
90 | mediacontrollerFileName.setText(name);
91 | }
92 |
93 | public void onProgressUpdate(long current, long duration) {
94 | setProgress();
95 | }
96 |
97 | @Override
98 | public boolean onSingleTapConfirmed() {
99 | return false;
100 | }
101 |
102 | @Override
103 | public void onDoubleTap() {
104 |
105 | }
106 |
107 |
108 | private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() {
109 | public void onStartTrackingTouch(SeekBar bar) {
110 | mDragging = true;
111 | }
112 |
113 | public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) {
114 | if (!fromuser)
115 | return;
116 | long newposition = (mDuration * progress) / 1000;
117 | String time = StringUtils.generateTime(newposition);
118 | if (mInstantSeeking)
119 | mPlayer.seekTo((int)newposition);
120 | if (mCurrentTime != null)
121 | mCurrentTime.setText(time);
122 | }
123 |
124 | public void onStopTrackingTouch(SeekBar bar) {
125 | if (!mInstantSeeking)
126 | mPlayer.seekTo((int)(mDuration * bar.getProgress()) / 1000);
127 | mDragging = false;
128 | }
129 | };
130 |
131 | public boolean isDragging() {
132 | return mDragging;
133 | }
134 |
135 |
136 | public MediaControllerFull(View layoutRootView, MediaPlayerControl player, FullScreenControl fullScreenControl) {
137 | ButterKnife.bind(this, layoutRootView);
138 | this.mPlayer = player;
139 | this.fullScreenControl = fullScreenControl;
140 | initView();
141 | }
142 |
143 | private void initView() {
144 | mediacontrollerLock.setSelected(MySensorListener.isLock());
145 | mProgress.setPadding(0, 0, 0, 0);
146 | mProgress.setOnSeekBarChangeListener(mSeekListener);
147 | mProgress.setMax(1000);
148 | mProgress.setThumbOffset(0);
149 | }
150 |
151 |
152 | /**
153 | * Control the action when the seekbar dragged by user
154 | *
155 | * @param seekWhenDragging True the media will seek periodically
156 | */
157 | public void setInstantSeeking(boolean seekWhenDragging) {
158 | mInstantSeeking = seekWhenDragging;
159 | }
160 |
161 |
162 | private boolean mShowing;
163 |
164 | public void show() {
165 | if (mShowing) {
166 | return;
167 | }
168 | mShowing = true;
169 | startOpenAnimation();
170 | }
171 |
172 |
173 | @Override
174 | public void show(int time) {
175 |
176 | }
177 |
178 | public void hide() {
179 | if (mShowing) {
180 | mShowing = false;
181 | startHideAnimation();
182 | }
183 | }
184 |
185 | public void close() {
186 | mShowing = false;
187 | upLayout.setVisibility(View.GONE);
188 | down_layout.setVisibility(View.GONE);
189 | conterLayout.setVisibility(View.GONE);
190 | }
191 |
192 | @Override
193 | public void changeLayoutState(int layoutState) {
194 |
195 | }
196 |
197 | public void startOpenAnimation() {
198 | if (down_layout.getVisibility() != View.VISIBLE) {
199 | down_layout.setVisibility(View.VISIBLE);
200 | }
201 | if (upLayout.getVisibility() != View.VISIBLE) {
202 | upLayout.setVisibility(View.VISIBLE);
203 | }
204 | if (conterLayout.getVisibility() != View.VISIBLE) {
205 | conterLayout.setVisibility(View.VISIBLE);
206 | }
207 |
208 | Animation in_from_fade = AnimationUtils.loadAnimation(down_layout.getContext(), R.anim.in_from_fade);
209 | Animation in_from_down = AnimationUtils.loadAnimation(down_layout.getContext(), R.anim.in_from_down);
210 | Animation in_from_up = AnimationUtils.loadAnimation(down_layout.getContext(), R.anim.in_from_up);
211 |
212 | conterLayout.clearAnimation();
213 | conterLayout.startAnimation(in_from_fade);
214 |
215 | upLayout.clearAnimation();
216 | upLayout.startAnimation(in_from_up);
217 |
218 | down_layout.clearAnimation();
219 | down_layout.startAnimation(in_from_down);
220 | }
221 |
222 | public void startHideAnimation() {
223 | Animation out_from_down = AnimationUtils.loadAnimation(down_layout.getContext(), R.anim.out_from_down);
224 | Animation out_from_up = AnimationUtils.loadAnimation(down_layout.getContext(), R.anim.out_from_up);
225 | Animation out_from_fade = AnimationUtils.loadAnimation(down_layout.getContext(), R.anim.out_from_fade);
226 |
227 | // out_from_fade.setAnimationListener(animationListener);
228 | // out_from_up.setAnimationListener(animationListener);
229 | out_from_down.setAnimationListener(animationListener);
230 |
231 | conterLayout.clearAnimation();
232 | conterLayout.startAnimation(out_from_fade);
233 |
234 | upLayout.clearAnimation();
235 | upLayout.startAnimation(out_from_up);
236 |
237 | down_layout.clearAnimation();
238 | down_layout.startAnimation(out_from_down);
239 | }
240 |
241 | public Animation.AnimationListener animationListener = new Animation.AnimationListener() {
242 | @Override
243 | public void onAnimationStart(Animation animation) {
244 | }
245 |
246 | @Override
247 | public void onAnimationEnd(Animation animation) {
248 | down_layout.setVisibility(View.GONE);
249 | upLayout.setVisibility(View.GONE);
250 | conterLayout.setVisibility(View.GONE);
251 | }
252 |
253 | @Override
254 | public void onAnimationRepeat(Animation animation) {
255 |
256 | }
257 | };
258 |
259 | public boolean isShowing() {
260 | return mShowing;
261 | }
262 |
263 |
264 | private long setProgress() {
265 | if (!mShowing || mDragging)
266 | return 0;
267 | long position = mPlayer.getCurrentPosition();
268 | long duration = mPlayer.getDuration();
269 | if (mProgress != null) {
270 | if (duration > 0) {
271 | long pos = 1000L * position / duration;
272 | mProgress.setProgress((int) pos);
273 | }
274 | //int percent = mPlayer.getBufferPercentage();
275 | //mProgress.setSecondaryProgress(percent * 10);
276 | }
277 | updatePausePlay();
278 | mDuration = duration;
279 | if (mCurrentTime != null)
280 | mCurrentTime.setText(StringUtils.generateTime(position) + " / " + StringUtils.generateTime(mDuration));
281 | return position;
282 | }
283 |
284 |
285 | public void setLoop(boolean loop) {
286 | loopButton.setSelected(loop);
287 | }
288 |
289 | public void setEnabled(boolean enabled) {
290 | if (mProgress != null)
291 | mProgress.setEnabled(enabled);
292 |
293 | }
294 |
295 | private void updatePausePlay() {
296 | mPauseButton.setSelected(mPlayer.isPlaying());
297 | }
298 |
299 | public void hideLastButton() {
300 | mediacontrollerLast.setEnabled(false);
301 | }
302 |
303 | public void showLastButton() {
304 | mediacontrollerLast.setEnabled(true);
305 | }
306 |
307 | public void hideNextButton() {
308 | mediacontrollerNext.setEnabled(false);
309 | }
310 |
311 | public void showNextButton() {
312 | mediacontrollerNext.setEnabled(true);
313 | }
314 |
315 | private void doPauseResume() {
316 | if (mPlayer.isPlaying()) {
317 | mPlayer.pause();
318 | } else {
319 | mPlayer.start();
320 | }
321 | updatePausePlay();
322 | }
323 |
324 | private int speed = 1;
325 |
326 | private void setSpeed() {
327 | String speedText = "1.0X";
328 | switch (speed) {
329 | case 1:
330 | mPlayer.setPlaybackSpeedMedia(0.25f);
331 | speed = 2;
332 | speedText = "0.2X";
333 | break;
334 | case 2:
335 | mPlayer.setPlaybackSpeedMedia(0.4f);
336 | speed = 4;
337 | speedText = "0.4X";
338 | break;
339 | case 4:
340 | mPlayer.setPlaybackSpeedMedia(0.6f);
341 | speed = 6;
342 | speedText = "0.6X";
343 | break;
344 | case 6:
345 | mPlayer.setPlaybackSpeedMedia(0.8f);
346 | speed = 8;
347 | speedText = "0.8X";
348 | break;
349 | case 8:
350 | mPlayer.setPlaybackSpeedMedia(1f);
351 | speed = 1;
352 | speedText = "1.0X";
353 | break;
354 | }
355 | mediacontroller_speed_change.setText(speedText);
356 | }
357 |
358 |
359 | @OnClick({R.id.mediacontroller_speed_change, R.id.mediacontroller_back, R.id.mediacontroller_projection, R.id.mediacontroller_lock, R.id.mediacontroller_share, R.id.mediacontroller_playmode, R.id.mediacontroller_last, R.id.mediacontroller_play_pause, R.id.mediacontroller_next, R.id.mediacontroller_mirror})
360 | public void onClick(View view) {
361 | LogUtils.i("view.getId()=" + view.getId());
362 | fullScreenControl.clickEvent();
363 | switch (view.getId()) {
364 | case R.id.mediacontroller_speed_change:
365 | setSpeed();
366 | break;
367 | case R.id.mediacontroller_back:
368 | fullScreenClick.back(view);
369 | break;
370 | case R.id.mediacontroller_projection://二维码切屏
371 | fullScreenClick.projection(view);
372 | break;
373 | case R.id.mediacontroller_lock:
374 | MySensorListener.setLock(!MySensorListener.isLock());
375 | view.setSelected(MySensorListener.isLock());
376 | break;
377 | case R.id.mediacontroller_playmode:
378 | // boolean singleCyclePlay = !PrefCache.getLoopPlay(view.getContext());
379 | // PrefCache.saveLoopPlay(view.getContext(), singleCyclePlay);
380 | // mPlayer.setLoop(singleCyclePlay);
381 | // setLoop(singleCyclePlay);
382 | break;
383 | case R.id.mediacontroller_last:
384 | fullScreenClick.last(view);
385 | break;
386 | case R.id.mediacontroller_play_pause:
387 | doPauseResume();
388 | break;
389 | case R.id.mediacontroller_next:
390 | fullScreenClick.next(view);
391 | break;
392 | case R.id.mediacontroller_mirror:
393 | boolean mirror = !mPlayer.getMirror();
394 | boolean mirrorState = !view.isSelected();
395 | mPlayer.setMirror(mirror);
396 | setMirrorState(mirrorState);
397 | break;
398 | case R.id.mediacontroller_share:
399 | fullScreenClick.share(view);
400 | break;
401 | }
402 | }
403 |
404 |
405 | public void setMirrorState(boolean mirror) {
406 | mediacontrollerMirror.setText(mirror ? "已镜面" : "未镜面");
407 | mediacontrollerMirror.setSelected(mirror);
408 | }
409 |
410 |
411 | public void setMirrorEnable(boolean enable) {
412 |
413 | }
414 |
415 | private FullScreenClick fullScreenClick;
416 |
417 | public void setFullScreenClick(FullScreenClick fullScreenClick) {
418 | this.fullScreenClick = fullScreenClick;
419 | }
420 |
421 | @Override
422 | public void eventBuffing(int event, float buffing) {
423 |
424 | }
425 |
426 | @Override
427 | public void eventPlayInit(boolean opening) {
428 |
429 | }
430 |
431 | @Override
432 | public void eventStop(boolean isPlayError) {
433 |
434 | }
435 |
436 | @Override
437 | public void eventError(int error, boolean show) {
438 |
439 | }
440 |
441 | @Override
442 | public void eventPlay(boolean isPlaying) {
443 |
444 | }
445 |
446 |
447 |
448 |
449 | public interface FullScreenClick {
450 | void share(View view);
451 |
452 | void last(View view);
453 |
454 | void next(View view);
455 |
456 | void back(View view);
457 |
458 | void projection(View view);
459 |
460 | }
461 | }
462 |
--------------------------------------------------------------------------------
/demo/src/main/java/com/videolist/yyl/view/VideoAdapter.java:
--------------------------------------------------------------------------------
1 | package com.videolist.yyl.view;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.ImageView;
8 | import android.widget.TextView;
9 |
10 | import com.bumptech.glide.Glide;
11 | import com.videolist.yyl.R;
12 | import com.videolist.yyl.dao.VideoItemData;
13 | import com.yyl.videolist.video.VlcMediaView;
14 |
15 | import java.util.ArrayList;
16 | import java.util.List;
17 |
18 |
19 | /**
20 | * Created by Administrator on 2016/10/17/017.
21 | */
22 |
23 | public class VideoAdapter extends RecyclerView.Adapter {
24 |
25 | private List list = new ArrayList<>();
26 | VlcMediaView vlcVideoView;
27 |
28 | public VideoAdapter(VlcMediaView vlcVideoView) {
29 | this.vlcVideoView = vlcVideoView;
30 | }
31 |
32 | @Override
33 | public VideoViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
34 | View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_video, parent, false);
35 | return new VideoViewHolder(view);
36 | }
37 |
38 | @Override
39 | public void onBindViewHolder(VideoViewHolder holder, int position) {
40 | holder.setData(position);
41 | }
42 |
43 | @Override
44 | public int getItemCount() {
45 | return list.size();
46 | }
47 |
48 | public void refresh(List list) {
49 | this.list.clear();
50 | this.list.addAll(list);
51 | notifyDataSetChanged();
52 | }
53 |
54 | public class VideoViewHolder extends RecyclerView.ViewHolder {
55 | TextView title;
56 | ImageView cover;
57 | TextView from;
58 | TextView vlc_type;
59 |
60 | public VideoViewHolder(View itemView) {
61 | super(itemView);
62 | title=itemView.findViewById(R.id.vlc_title);
63 | cover=itemView.findViewById(R.id.cover);
64 | from=itemView.findViewById(R.id.vlc_from);
65 | vlc_type=itemView.findViewById(R.id.vlc_type);
66 | }
67 |
68 | public void setData(final int position) {
69 | final VideoItemData videoItemData = list.get(position);
70 | title.setText(videoItemData.getTitle());
71 | cover.setOnClickListener(new View.OnClickListener() {
72 | @Override
73 | public void onClick(View v) {
74 | vlcVideoView.onClickViewPlay(v, videoItemData.getMp4_url());
75 | }
76 | });
77 | Glide.with(cover.getContext()).load(videoItemData.getCover()).into(cover);
78 | from.setText(videoItemData.getVideosource());
79 | vlc_type.setText(videoItemData.getType() + "=type");
80 | }
81 | }
82 |
83 | }
--------------------------------------------------------------------------------
/demo/src/main/res/anim/activity_close.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/activity_open.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/context.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/fade_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/fade_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/flash.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
25 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/image_button_anim.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/image_button_anim_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/image_button_anim_translate.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/image_button_anim_translate_close.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/in_from_down.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/in_from_fade.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/in_from_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/in_from_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/in_from_up.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/out_from_down.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/out_from_fade.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/out_from_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/out_from_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/out_from_up.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/push_bottom_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/push_bottom_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/demo/src/main/res/anim/record_focus.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
19 |
25 |
37 |
38 |
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/mediacontroller_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/mediacontroller_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/drawable/mediacontroller_change.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/mediacontroller_img_loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/drawable/mediacontroller_img_loading.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/mediacontroller_small_pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/drawable/mediacontroller_small_pause.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/mediacontroller_small_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/drawable/mediacontroller_small_play.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/mediacontroller_speed.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/mediacontroller_speed_last.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/drawable/mediacontroller_speed_last.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/mediacontroller_speed_next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/drawable/mediacontroller_speed_next.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/play_control_scrubber.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/drawable/play_control_scrubber.9.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/play_control_scrubber2.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/drawable/play_control_scrubber2.9.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/scrubber_primary_holo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/drawable/scrubber_primary_holo.9.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/scrubber_progress_horizontal_holo_dark.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
16 | -
17 |
20 |
21 | -
22 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/scrubber_secondary_holo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/drawable/scrubber_secondary_holo.9.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/seek_thumb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/drawable/seek_thumb.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/seekbar_horizontal.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | -
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
16 |
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/video_progressbar_drawable.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/activity_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/activity_list_video.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
19 |
20 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
21 |
22 |
27 |
28 |
33 |
34 |
39 |
40 |
45 |
46 |
51 |
52 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/activity_mini_video.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/activity_othere.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/activity_rtsp.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
18 |
19 |
24 |
25 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/activity_view_page_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/item_video.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
17 |
18 |
21 |
22 |
27 |
28 |
33 |
34 |
35 |
39 |
40 |
49 |
50 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/video_view_controller_full.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
18 |
19 |
27 |
28 |
36 |
37 |
38 |
44 |
45 |
52 |
53 |
60 |
61 |
68 |
69 |
70 |
71 |
78 |
79 |
85 |
86 |
87 |
88 |
94 |
95 |
104 |
105 |
106 |
115 |
116 |
122 |
123 |
130 |
131 |
137 |
138 |
145 |
146 |
147 |
148 |
159 |
160 |
169 |
170 |
171 |
183 |
184 |
185 |
186 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/videoview_vlc_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
17 |
18 |
22 |
23 |
31 |
32 |
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-xxhdpi/course_player_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/mipmap-xxhdpi/course_player_play.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/raw/video_list.json:
--------------------------------------------------------------------------------
1 | {
2 | "list":[{
3 | "topicImg": "http://vimg1.ws.126.net/image/snapshot/2016/4/7/G/VBILRDA7G.jpg",
4 | "replyCount": 0,
5 | "videosource": "新媒体",
6 | "mp4Hd_url": null,
7 | "topicDesc": "此诚哥非彼诚哥",
8 | "topicSid": "VBILRDA7E",
9 | "cover": "http://vimg1.ws.126.net/image/snapshot/2016/4/3/7/VBKQP3437.jpg",
10 | "title": "我看过魔术之中最牛逼的一个",
11 | "playCount": 12336,
12 | "replyBoard": "video_bbs",
13 | "videoTopic": {
14 | "alias": "此诚哥非彼诚哥",
15 | "tname": "诚哥讲笑话",
16 | "ename": "T1460515708449",
17 | "tid": "T1460515708449"
18 | },
19 | "sectiontitle": "",
20 | "description": "我的天,他是怎么做到的。。。",
21 | "replyid": "BKQP3436008535RB",
22 | "mp4_url": "http://flv2.bn.netease.com/videolib3/1604/28/fVobI0704/SD/fVobI0704-mobile.mp4",
23 | "length": 65,
24 | "playersize": 1,
25 | "m3u8Hd_url": null,
26 | "vid": "VBKQP3436",
27 | "m3u8_url": "http://flv2.bn.netease.com/videolib3/1604/28/fVobI0704/SD/movie_index.m3u8",
28 | "ptime": "2016-04-28 16:04:50",
29 | "topicName": "诚哥讲笑话"
30 | }, {
31 | "topicImg": "http://vimg2.ws.126.net/image/snapshot/2016/2/I/M/VBG7HE1IM.jpg",
32 | "replyCount": 0,
33 | "videosource": "新媒体",
34 | "mp4Hd_url": null,
35 | "topicDesc": "不开心?来这寻找最快乐的自己",
36 | "topicSid": "VBG2BBJ7H",
37 | "cover": "http://vimg3.ws.126.net/image/snapshot/2016/4/U/0/VBKQOPUU0.jpg",
38 | "title": "逗比美女:养我也是为了吃肉吗",
39 | "playCount": 9448,
40 | "replyBoard": "video_bbs",
41 | "videoTopic": {
42 | "alias": "不开心?来这寻找最快乐的自己",
43 | "tname": "逗比对嘴表演",
44 | "ename": "T1460515712745",
45 | "tid": "T1460515712745"
46 | },
47 | "sectiontitle": "",
48 | "description": "小咖秀合作",
49 | "replyid": "BKQOAO51008535RB",
50 | "mp4_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/G/O/EBKQOA8GO/SD/EBKQOA8GO-mobile.mp4",
51 | "length": 17,
52 | "playersize": 0,
53 | "m3u8Hd_url": null,
54 | "vid": "VBKQOAO51",
55 | "m3u8_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/G/O/EBKQOA8GO/SD/movie_index.m3u8",
56 | "ptime": "2016-04-28 15:51:15",
57 | "topicName": "逗比对嘴表演"
58 | }, {
59 | "topicImg": "http://vimg2.ws.126.net/image/snapshot/2016/3/5/S/VBHT6285S.jpg",
60 | "replyCount": 0,
61 | "videosource": "新媒体",
62 | "mp4Hd_url": null,
63 | "topicDesc": "让你每天笑不停。",
64 | "topicSid": "VBHT6285Q",
65 | "cover": "http://vimg3.ws.126.net/image/snapshot/2016/4/0/R/VBKQOOU0R.jpg",
66 | "title": "女蛇精病唱民歌:把这段话念一遍",
67 | "playCount": 9600,
68 | "replyBoard": "video_bbs",
69 | "videoTopic": {
70 | "alias": "让你每天笑不停。",
71 | "tname": "十秒你就笑",
72 | "ename": "T1460515715472",
73 | "tid": "T1460515715472"
74 | },
75 | "sectiontitle": "",
76 | "description": "小咖秀合作",
77 | "replyid": "BKQO9M84008535RB",
78 | "mp4_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/M/Q/EBKQO95MQ/SD/EBKQO95MQ-mobile.mp4",
79 | "length": 32,
80 | "playersize": 0,
81 | "m3u8Hd_url": null,
82 | "vid": "VBKQO9M84",
83 | "m3u8_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/M/Q/EBKQO95MQ/SD/movie_index.m3u8",
84 | "ptime": "2016-04-28 15:50:40",
85 | "topicName": "十秒你就笑"
86 | }, {
87 | "topicImg": "http://vimg1.ws.126.net/image/snapshot/2016/4/C/0/VBJ4774C0.jpg",
88 | "replyCount": 0,
89 | "videosource": "新媒体",
90 | "mp4Hd_url": null,
91 | "topicDesc": "这里有世界各地的奇葩事",
92 | "topicSid": "VBJ4774BU",
93 | "cover": "http://vimg1.ws.126.net/image/snapshot/2016/4/C/L/VBKQOOPCL.jpg",
94 | "title": "呆萌妹子实力出演:可爱皮卡丘",
95 | "playCount": 9117,
96 | "replyBoard": "video_bbs",
97 | "videoTopic": {
98 | "alias": "这里有世界各地的奇葩事",
99 | "tname": "阿拉伯飞毯",
100 | "ename": "T1460515711614",
101 | "tid": "T1460515711614"
102 | },
103 | "sectiontitle": "",
104 | "description": "小咖秀合作",
105 | "replyid": "BKQO86Q5008535RB",
106 | "mp4_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/G/S/EBKQO7TGS/SD/EBKQO7TGS-mobile.mp4",
107 | "length": 9,
108 | "playersize": 0,
109 | "m3u8Hd_url": null,
110 | "vid": "VBKQO86Q5",
111 | "m3u8_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/G/S/EBKQO7TGS/SD/movie_index.m3u8",
112 | "ptime": "2016-04-28 15:49:59",
113 | "topicName": "阿拉伯飞毯"
114 | }, {
115 | "topicImg": "http://vimg3.ws.126.net/image/snapshot/2016/3/C/N/VBG7AA2CN.jpg",
116 | "replyCount": 0,
117 | "videosource": "新媒体",
118 | "mp4Hd_url": null,
119 | "topicDesc": "你是猴子请来的逗比么?",
120 | "topicSid": "VBG7AA2CK",
121 | "cover": "http://vimg1.ws.126.net/image/snapshot/2016/4/7/E/VBKQOA87E.jpg",
122 | "title": "史上最诱惑的广告,基本广告词说完大家也不知道在说什么",
123 | "playCount": 9448,
124 | "replyBoard": "video_bbs",
125 | "videoTopic": {
126 | "alias": "你是猴子请来的逗比么?",
127 | "tname": "有一种美女叫逗比",
128 | "ename": "T1460515706915",
129 | "tid": "T1460515706915"
130 | },
131 | "sectiontitle": "",
132 | "description": "小咖秀合作",
133 | "replyid": "BKQO3HRO008535RB",
134 | "mp4_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/0/K/EBKQO3C0K-mobile.mp4",
135 | "length": 17,
136 | "playersize": 0,
137 | "m3u8Hd_url": null,
138 | "vid": "VBKQO3HRO",
139 | "m3u8_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/0/K/EBKQO3C0K-mobile.mp4",
140 | "ptime": "2016-04-28 15:47:30",
141 | "topicName": "有一种美女叫逗比"
142 | }, {
143 | "topicImg": "http://vimg2.ws.126.net/image/snapshot/2016/2/U/L/VBG7H0SUL.jpg",
144 | "replyCount": 0,
145 | "videosource": "新媒体",
146 | "mp4Hd_url": null,
147 | "topicDesc": "不说不笑不热闹",
148 | "topicSid": "VBFGARMFR",
149 | "cover": "http://vimg2.ws.126.net/image/snapshot/2016/4/I/V/VBKQOCKIV.jpg",
150 | "title": "男子逗比搞笑自语:下雨了出去洗个头",
151 | "playCount": 19721,
152 | "replyBoard": "video_bbs",
153 | "videoTopic": {
154 | "alias": "不说不笑不热闹",
155 | "tname": "搞笑一箩筐",
156 | "ename": "T1460515708679",
157 | "tid": "T1460515708679"
158 | },
159 | "sectiontitle": "",
160 | "description": "小咖秀合作",
161 | "replyid": "BKQO37QV008535RB",
162 | "mp4_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/I/G/EBKQO2SIG/SD/EBKQO2SIG-mobile.mp4",
163 | "length": 39,
164 | "playersize": 0,
165 | "m3u8Hd_url": null,
166 | "vid": "VBKQO37QV",
167 | "m3u8_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/I/G/EBKQO2SIG/SD/movie_index.m3u8",
168 | "ptime": "2016-04-28 15:47:14",
169 | "topicName": "搞笑一箩筐"
170 | }, {
171 | "topicImg": "http://vimg1.ws.126.net/image/snapshot/2016/2/I/M/VBG7HE1IM.jpg",
172 | "replyCount": 0,
173 | "videosource": "新媒体",
174 | "mp4Hd_url": null,
175 | "topicDesc": "不开心?来这寻找最快乐的自己",
176 | "topicSid": "VBG2BBJ7H",
177 | "cover": "http://vimg3.ws.126.net/image/snapshot/2016/4/C/4/VBKQO4JC4.jpg",
178 | "title": "逗逼制服美女之旅客朋友们请注意啦",
179 | "playCount": 9768,
180 | "replyBoard": "video_bbs",
181 | "videoTopic": {
182 | "alias": "不开心?来这寻找最快乐的自己",
183 | "tname": "逗比对嘴表演",
184 | "ename": "T1460515712745",
185 | "tid": "T1460515712745"
186 | },
187 | "sectiontitle": "",
188 | "description": "小咖秀合作",
189 | "replyid": "BKQO0LN8008535RB",
190 | "mp4_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/5/G/EBKQO085G/SD/EBKQO085G-mobile.mp4",
191 | "length": 40,
192 | "playersize": 0,
193 | "m3u8Hd_url": null,
194 | "vid": "VBKQO0LN8",
195 | "m3u8_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/5/G/EBKQO085G/SD/movie_index.m3u8",
196 | "ptime": "2016-04-28 15:45:47",
197 | "topicName": "逗比对嘴表演"
198 | }, {
199 | "topicImg": "http://vimg2.ws.126.net/image/snapshot/2016/2/B/5/VBG7H5IB5.jpg",
200 | "replyCount": 0,
201 | "videosource": "新媒体",
202 | "mp4Hd_url": null,
203 | "topicDesc": "探索世界,捕捉甜虾奇闻怪诞。",
204 | "topicSid": "VBFGGQAN8",
205 | "cover": "http://vimg3.ws.126.net/image/snapshot/2016/4/I/V/VBKQNCCIV.jpg",
206 | "title": "我家一条巷相隔六尺宽包容无线大",
207 | "playCount": 9847,
208 | "replyBoard": "video_bbs",
209 | "videoTopic": {
210 | "alias": "探索世界,捕捉甜虾奇闻怪诞。",
211 | "tname": "奇闻异事",
212 | "ename": "T1460515709001",
213 | "tid": "T1460515709001"
214 | },
215 | "sectiontitle": "",
216 | "description": "六尺巷",
217 | "replyid": "BKQN40G0008535RB",
218 | "mp4_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/U/4/EBKQN3GU4/SD/EBKQN3GU4-mobile.mp4",
219 | "length": 36,
220 | "playersize": 0,
221 | "m3u8Hd_url": null,
222 | "vid": "VBKQN40G0",
223 | "m3u8_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/U/4/EBKQN3GU4/SD/movie_index.m3u8",
224 | "ptime": "2016-04-28 15:30:06",
225 | "topicName": "奇闻异事"
226 | }, {
227 | "topicImg": "http://vimg1.ws.126.net/image/snapshot/2016/3/B/0/VBI02ISB0.jpg",
228 | "replyCount": 0,
229 | "videosource": "新媒体",
230 | "mp4Hd_url": null,
231 | "topicDesc": "狗哥出品,必属精品。",
232 | "topicSid": "VBI02ISAT",
233 | "cover": "http://vimg3.ws.126.net/image/snapshot/2016/4/4/O/VBKQMQE4O.jpg",
234 | "title": "教你如何当一位完美的男友",
235 | "playCount": 18049,
236 | "replyBoard": "video_bbs",
237 | "videoTopic": {
238 | "alias": "狗哥出品,必属精品。",
239 | "tname": "东北李二狗",
240 | "ename": "T1460515706478",
241 | "tid": "T1460515706478"
242 | },
243 | "sectiontitle": "",
244 | "description": "单身狗哭晕,这样的女友还不珍惜。",
245 | "replyid": "BKQMKH2P008535RB",
246 | "mp4_url": "http://flv2.bn.netease.com/videolib3/1604/28/Dgwkr8165/SD/Dgwkr8165-mobile.mp4",
247 | "length": 70,
248 | "playersize": 0,
249 | "m3u8Hd_url": null,
250 | "vid": "VBKQMKH2P",
251 | "m3u8_url": "http://flv2.bn.netease.com/videolib3/1604/28/Dgwkr8165/SD/movie_index.m3u8",
252 | "ptime": "2016-04-28 15:21:55",
253 | "topicName": "东北李二狗"
254 | }, {
255 | "topicImg": "http://vimg1.ws.126.net/image/snapshot/2016/3/C/6/VBI02GKC6.jpg",
256 | "replyCount": 0,
257 | "videosource": "新媒体",
258 | "mp4Hd_url": null,
259 | "topicDesc": "让你开心每一天。",
260 | "topicSid": "VBI02GKC3",
261 | "cover": "http://vimg1.ws.126.net/image/snapshot/2016/4/S/R/VBKQMQFSR.jpg",
262 | "title": "逗比美女的逗比故事:和老外打招呼",
263 | "playCount": 9511,
264 | "replyBoard": "video_bbs",
265 | "videoTopic": {
266 | "alias": "让你开心每一天。",
267 | "tname": "劲爆搞笑",
268 | "ename": "T1460515706582",
269 | "tid": "T1460515706582"
270 | },
271 | "sectiontitle": "",
272 | "description": "小咖秀合作",
273 | "replyid": "BKQMD062008535RB",
274 | "mp4_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/N/C/EBKQMCMNC/SD/EBKQMCMNC-mobile.mp4",
275 | "length": 20,
276 | "playersize": 0,
277 | "m3u8Hd_url": null,
278 | "vid": "VBKQMD062",
279 | "m3u8_url": "http://flv2.bn.netease.com/tvmrepo/2016/4/N/C/EBKQMCMNC/SD/movie_index.m3u8",
280 | "ptime": "2016-04-28 15:17:38",
281 | "topicName": "劲爆搞笑"
282 | }]
283 |
284 | }
--------------------------------------------------------------------------------
/demo/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/demo/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #FFC93437
7 | #FF375BF1
8 | #FFF7D23E
9 | #f5df84
10 | #FF34A350
11 | #ffffffff
12 | #000000
13 | #7f000000
14 |
15 | #CC000000
16 | #7f000000
17 | #26000000
18 | #66000000
19 | #bf000000
20 | #40000000
21 | #DA000000
22 | #4D000000
23 | #70000000
24 | #80000000
25 |
26 |
27 | #ff53c1bd
28 | #99000000
29 | #b4000000
30 | #65000000
31 | #ffd10c
32 | #17e49f
33 |
34 | #1d9973
35 | #1cb467
36 | #EAEBED
37 | #9d9d9d
38 | #606060
39 | #4a4b52
40 | #666880
41 |
42 |
--------------------------------------------------------------------------------
/demo/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 30.0sp
6 | 23.0sp
7 | 22.0sp
8 | 21.0sp
9 | 20.0sp
10 | 19.0sp
11 | 18.0sp
12 | 17.0sp
13 | 16.0sp
14 | 15.0sp
15 | 14.0sp
16 | 13.0sp
17 | 12.0sp
18 | 11.0sp
19 | 10.0sp
20 | 9.0sp
21 | 8.0sp
22 | 7.0sp
23 | 15.0sp
24 |
25 |
26 |
--------------------------------------------------------------------------------
/demo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | VideoList
3 |
4 |
--------------------------------------------------------------------------------
/demo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
15 |
16 |
21 |
26 |
27 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Nov 04 14:40:53 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/ijkplayer/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/ijkplayer/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 26
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 15
10 | targetSdkVersion 26
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: 'libs', include: ['*.jar'])
29 |
30 | implementation 'com.android.support:appcompat-v7:26.1.0'
31 | testImplementation 'junit:junit:4.12'
32 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
33 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
34 | }
35 |
--------------------------------------------------------------------------------
/ijkplayer/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/ijkplayer/src/androidTest/java/yyl/ijkplayer/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package yyl.ijkplayer;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("yyl.ijkplayer.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ijkplayer/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/ijkplayer/src/main/java/yyl/ijkplayer/VideoView.java:
--------------------------------------------------------------------------------
1 | package yyl.ijkplayer;
2 |
3 | /**
4 | * Created by yyl on 2018/2/24.
5 | */
6 | public class VideoView {
7 |
8 |
9 |
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/ijkplayer/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ijkplayer
3 |
4 |
--------------------------------------------------------------------------------
/ijkplayer/src/test/java/yyl/ijkplayer/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package yyl.ijkplayer;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':demo', ':ijkplayer'
2 | include ':vlcplayer'
3 |
--------------------------------------------------------------------------------
/vlcplayer/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/vlcplayer/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 26
5 | buildToolsVersion "26.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 15
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile 'com.android.support:appcompat-v7:26.1.0'
23 | compile 'com.android.support:recyclerview-v7:26.1.0'
24 | compile 'com.yyl.vlc:vlc-android-sdk:2.5.17'
25 | }
26 |
--------------------------------------------------------------------------------
/vlcplayer/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\eclipse\android-sdk-windows/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/FrameLayoutScale.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 | import android.widget.FrameLayout;
7 |
8 |
9 |
10 | /**
11 | * Created by Administrator on 2016/11/22/022.
12 | */
13 |
14 | public class FrameLayoutScale extends FrameLayout {
15 |
16 | private float videoScale = 9f / 16f;
17 | private float lastScale = videoScale;
18 | private String tag = "FrameLayoutScale";
19 |
20 | public FrameLayoutScale(Context context) {
21 | super(context);
22 | }
23 |
24 | public FrameLayoutScale(Context context, AttributeSet attrs) {
25 | super(context, attrs);
26 | init(context, attrs);
27 | }
28 |
29 | public FrameLayoutScale(Context context, AttributeSet attrs, int defStyleAttr) {
30 | super(context, attrs, defStyleAttr);
31 | init(context, attrs);
32 | }
33 |
34 | private void init(Context context, AttributeSet attrs) {
35 |
36 | }
37 |
38 | @Override
39 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
40 | onMeasureVideo(widthMeasureSpec, heightMeasureSpec, getLayoutParams().height);
41 | }
42 |
43 | private void onMeasureVideo(int widthMeasureSpec, int heightMeasureSpec, int heightParams) {
44 | int measureWidth = MeasureSpec.getSize(widthMeasureSpec);
45 | int measureHeight = MeasureSpec.getSize(heightMeasureSpec);
46 | measureHeight = isFullVideoState ? measureHeight : (int) (measureWidth * videoScale);
47 | setMeasuredDimension(measureWidth, measureHeight);
48 | if (isFullVideoState && heightParams != FrameLayout.LayoutParams.MATCH_PARENT) {
49 | getLayoutParams().height = FrameLayout.LayoutParams.MATCH_PARENT;
50 | if (isInEditMode()) {
51 | setMeasuredDimension(measureWidth, measureHeight);
52 | }
53 | return;
54 | } else if (!isFullVideoState && heightParams != FrameLayout.LayoutParams.WRAP_CONTENT) {
55 | getLayoutParams().height = FrameLayout.LayoutParams.WRAP_CONTENT;
56 | if (isInEditMode()) {
57 | setMeasuredDimension(measureWidth, measureHeight);
58 | }
59 | return;
60 | }
61 |
62 | int childCount = getChildCount();
63 | for (int i = 0; i < childCount; i++) {
64 | final View child = getChildAt(i);
65 | if (child.getVisibility() != GONE) {
66 | final int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(measureWidth, MeasureSpec.EXACTLY);
67 | final int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(measureHeight, MeasureSpec.EXACTLY);
68 | child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
69 | }
70 | }
71 | }
72 |
73 | public void setScaleVideo(float videoScale) {
74 | this.videoScale = videoScale;
75 | }
76 |
77 | private boolean isFullVideoState;
78 |
79 | public void setScaleFull(boolean full) {
80 | this.isFullVideoState = full;
81 | }
82 | }
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/MyVideoView.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 |
6 | /**
7 | * Created by yyl on 2018/2/24.
8 | */
9 |
10 | public class MyVideoView extends org.videolan.vlc.VlcVideoView {
11 | public MyVideoView(Context context) {
12 | super(context);
13 | }
14 |
15 | public MyVideoView(Context context, AttributeSet attrs) {
16 | super(context, attrs);
17 | }
18 |
19 | public MyVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
20 | super(context, attrs, defStyleAttr);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/demo/VBuffing.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.demo;
2 |
3 | /**
4 | * Created by Administrator on 2016/10/19/019.
5 | */
6 |
7 | public class VBuffing {
8 | }
9 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/demo/VideoControllerDemo.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.demo;
2 |
3 | import com.yyl.videolist.listeners.VideoViewControllerListeners;
4 |
5 | /**
6 | * Created by Administrator on 2016/10/20/020.
7 | */
8 |
9 | public class VideoControllerDemo implements VideoViewControllerListeners {
10 | @Override
11 | public boolean isDragging() {
12 | return false;
13 | }
14 |
15 | @Override
16 | public void close() {
17 |
18 | }
19 |
20 | @Override
21 | public void changeLayoutState(int layoutState) {
22 |
23 | }
24 |
25 | @Override
26 | public void show(int time) {
27 |
28 | }
29 |
30 | @Override
31 | public void hide() {
32 |
33 | }
34 |
35 | @Override
36 | public void onProgressUpdate(long current, long duration) {
37 |
38 | }
39 |
40 | @Override
41 | public boolean onSingleTapConfirmed() {
42 | return false;
43 | }
44 |
45 | @Override
46 | public void onDoubleTap() {
47 |
48 | }
49 |
50 |
51 | @Override
52 | public void eventBuffing(int event, float buffing) {
53 |
54 | }
55 |
56 | @Override
57 | public void eventPlayInit(boolean opening) {
58 |
59 | }
60 |
61 | @Override
62 | public void eventStop(boolean isPlayError) {
63 |
64 | }
65 |
66 | @Override
67 | public void eventError(int error, boolean show) {
68 |
69 | }
70 |
71 | @Override
72 | public void eventPlay(boolean isPlaying) {
73 |
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/listeners/FullScreenControl.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.listeners;
2 |
3 | import android.app.Activity;
4 |
5 | /**
6 | * Created by yuyunlong on 2016/7/16/016.
7 | */
8 | public interface FullScreenControl {
9 |
10 |
11 | boolean isFullScreen();
12 |
13 | void setFullscreen(Activity activity, boolean isFullscreen);
14 |
15 | /**
16 | * 点击显示菜单 show
17 | *
18 | * @return
19 | */
20 | boolean clickEvent();
21 | }
22 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/listeners/MediaPlayerChangeState.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.listeners;
2 |
3 | /**
4 | * Created by yuyunlong on 2016/7/16/016.
5 | */
6 | public interface MediaPlayerChangeState {
7 | int stateSmallFull = 0;//普通的大小屏切换
8 | int stateSmallList = 1;//列表播放
9 | int stateFull = 2;//只有大屏
10 | int stateNull = 3;//空的 预览视频
11 | void changeLayoutState(int layoutState);
12 | }
13 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/listeners/VideoSizeChange.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.listeners;
2 |
3 | /**
4 | * Created by yuyunlong on 2016/8/30/030.
5 | */
6 | public interface VideoSizeChange {
7 | /**
8 | *
9 | * @param width
10 | * @param height
11 | * @param rotation 视频角度 对应ffmpeg中的rotation 参数
12 | */
13 | void onVideoSizeChanged(int width, int height, boolean rotation);
14 | }
15 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/listeners/VideoViewControllerListeners.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.listeners;
2 |
3 | /**
4 | * Created by Administrator on 2016/10/19/019.
5 | */
6 |
7 | public interface VideoViewControllerListeners extends VideoViewListeners {
8 |
9 | /**
10 | * @return 是否在控制进度中
11 | */
12 | boolean isDragging();
13 |
14 | /**
15 | * 切换中关闭没有动画
16 | */
17 | void close();
18 |
19 |
20 | void changeLayoutState(int layoutState);
21 | }
22 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/listeners/VideoViewDetachedEvent.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.listeners;
2 |
3 | /**
4 | * Created by yyl on 2016/10/17/017.
5 | */
6 |
7 | public interface VideoViewDetachedEvent {
8 | void detachedEvent();
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/listeners/VideoViewListeners.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.listeners;
2 |
3 | import org.videolan.vlc.listener.MediaListenerEvent;
4 |
5 | /**
6 | * Created by Administrator on 2016/2/17/017.
7 | *
8 | * 所有的事件的定义
9 | */
10 | public interface VideoViewListeners extends MediaListenerEvent {
11 |
12 |
13 | void show(int time);
14 |
15 | void hide();
16 |
17 |
18 | void onProgressUpdate(long current, long duration);
19 |
20 |
21 | boolean onSingleTapConfirmed();
22 | void onDoubleTap();
23 | }
24 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/listeners/VideoViewTouchListeners.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.listeners;
2 |
3 | import android.app.Activity;
4 |
5 | /**
6 | * Created by Administrator on 2016/10/19/019.
7 | */
8 |
9 | public interface VideoViewTouchListeners extends MediaPlayerChangeState {
10 |
11 | void setError(boolean show);
12 |
13 | void setFullscreen(Activity activity, boolean isFullscreen);
14 | }
15 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/utils/LogUtils.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.utils;
2 |
3 | import android.util.Log;
4 |
5 | import org.videolan.BuildConfig;
6 |
7 | /**
8 | * Created by Administrator on 2016/10/12/012.
9 | */
10 |
11 | public class LogUtils {
12 | private static final boolean debug = true;
13 |
14 | public static void i(String tag, String msg) {
15 | if (debug)
16 | Log.i(tag, msg);
17 | }
18 |
19 | public static void i(String msg) {
20 | if (debug) Log.i("yyl", msg);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/utils/NetworkUtils.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.utils;
2 |
3 | import android.content.Context;
4 | import android.net.ConnectivityManager;
5 | import android.net.NetworkInfo;
6 | import android.view.View;
7 | import android.widget.Toast;
8 |
9 | /**
10 | * Created by yuyidong on 15/10/19.
11 | */
12 | public class NetworkUtils {
13 | /**
14 | * 判断当前网络是否连接
15 | *
16 | * @param context
17 | * @return
18 | */
19 | public static boolean isNetworkConnected(Context context) {
20 | if (context != null) {
21 | ConnectivityManager mConnectivityManager = (ConnectivityManager) context
22 | .getSystemService(Context.CONNECTIVITY_SERVICE);
23 | NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
24 | if (mNetworkInfo != null) {
25 | return mNetworkInfo.isConnected();
26 | }
27 | }
28 | return false;
29 | }
30 | /**
31 | * 判断当前网络是否连接
32 | *
33 | * @return
34 | */
35 | public static boolean checkNetWorkOrToast(View view) {
36 | if (NetworkUtils.isNetworkConnected(view.getContext())) {
37 | return false;
38 | } else {
39 | // ToastUtils.showToast(view, "网络不可用");
40 | Toast.makeText(view.getContext(),"网络不可用",Toast.LENGTH_SHORT).show();
41 | return true;
42 | }
43 | }
44 |
45 |
46 | /**
47 | * 判断wifi状态是否连接
48 | *
49 | * @param context
50 | * @return
51 | */
52 | public static final boolean isWifiConnected(Context context) {
53 | ConnectivityManager connectMgr = (ConnectivityManager) context
54 | .getSystemService(Context.CONNECTIVITY_SERVICE);
55 | NetworkInfo info = connectMgr.getActiveNetworkInfo();
56 | if (info != null && info.getType() == ConnectivityManager.TYPE_WIFI && info.isConnected()) {
57 | return true;
58 | } else {
59 | return false;
60 | }
61 | }
62 |
63 | public boolean isMobileConnected(Context context) {
64 | if (context != null) {
65 | ConnectivityManager mConnectivityManager = (ConnectivityManager) context
66 | .getSystemService(Context.CONNECTIVITY_SERVICE);
67 | NetworkInfo mMobileNetworkInfo = mConnectivityManager
68 | .getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
69 | if (mMobileNetworkInfo != null) {
70 | return mMobileNetworkInfo.isAvailable();
71 | }
72 | }
73 | return false;
74 | }
75 |
76 |
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/utils/StringUtils.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.utils;
2 |
3 | import android.content.Context;
4 | import android.text.SpannableStringBuilder;
5 |
6 | import java.io.UnsupportedEncodingException;
7 | import java.net.URLEncoder;
8 | import java.util.regex.Matcher;
9 | import java.util.regex.Pattern;
10 |
11 | /**
12 | * 字符串工具类
13 | *
14 | * @author WeiShiming
15 | */
16 | public class StringUtils {
17 | public static final String CHARSET_UTF_8 = "UTF-8";
18 |
19 | /**
20 | * 解决自动换行
21 | *
22 | * @param input
23 | * @return
24 | */
25 | public static String toSBC(String input) {
26 | if (isNull(input)) {
27 | return input;
28 | }
29 | char c[] = input.toCharArray();
30 | for (int i = 0; i < c.length; i++) {
31 | if (c[i] == ' ') {
32 | c[i] = '\u3000';
33 | } else if (c[i] < '\177') {
34 | c[i] = (char) (c[i] + 65248);
35 | }
36 | }
37 | return new String(c);
38 | }
39 |
40 | public static String fixLastSlash(String str) {
41 | String res = str == null ? "/" : str.trim() + "/";
42 | if (res.length() > 2 && res.charAt(res.length() - 2) == '/')
43 | res = res.substring(0, res.length() - 1);
44 | return res;
45 | }
46 |
47 | public static int convertToInt(String str) throws NumberFormatException {
48 | int s, e;
49 | for (s = 0; s < str.length(); s++)
50 | if (Character.isDigit(str.charAt(s)))
51 | break;
52 | for (e = str.length(); e > 0; e--)
53 | if (Character.isDigit(str.charAt(e - 1)))
54 | break;
55 | if (e > s) {
56 | try {
57 | return Integer.parseInt(str.substring(s, e));
58 | } catch (NumberFormatException ex) {
59 | throw new NumberFormatException();
60 | }
61 | } else {
62 | throw new NumberFormatException();
63 | }
64 | }
65 |
66 | public static String generateTime(long time) {
67 | int totalSeconds = (int) (time / 1000);
68 | int seconds = totalSeconds % 60;
69 | int minutes = (totalSeconds / 60) % 60;
70 | int hours = totalSeconds / 3600;
71 |
72 | return hours > 0 ? String.format("%02d:%02d:%02d", hours, minutes, seconds) : String.format("%02d:%02d", minutes, seconds);
73 | }
74 |
75 | /**
76 | * 创建一条带独占图标的字符串
77 | *
78 | * @param context
79 | * @param title
80 | * @return
81 | */
82 | public static CharSequence buildExclusiveTitle(Context context, String title) {
83 | SpannableStringBuilder ssb = new SpannableStringBuilder("0 ");
84 | ssb.append(title);
85 |
86 | // ssb.setSpan(new ImageSpan(context, R.drawable.ic_exclusive,
87 | // DynamicDrawableSpan.ALIGN_BASELINE), 0, 1,
88 | // Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
89 |
90 | return ssb;
91 | }
92 |
93 | public static String getOmitChar(int count) {
94 | StringBuffer buffer = new StringBuffer(count + "");
95 | if (count >= 1000000) {
96 | buffer.delete(buffer.length() - 4, buffer.length());
97 | buffer.append("w");
98 | } else if (count >= 10000) {
99 | buffer.delete(buffer.length() - 3, buffer.length());
100 | buffer.insert(buffer.length() - 1, ".");
101 | buffer.append("w");
102 | } else if (count >= 1000) {
103 | buffer.delete(buffer.length() - 2, buffer.length());
104 | buffer.insert(buffer.length() - 1, ".");
105 | buffer.append("k");
106 | }
107 | System.out.println(buffer);
108 | return buffer.toString();
109 | }
110 |
111 | public static String getOmitChar2(String count) {
112 | if (StringUtils.isNull(count)) {
113 | return "0";
114 | }
115 | StringBuffer buffer = new StringBuffer(count + "");
116 | int nubm = 0;
117 | try {
118 | nubm = Integer.valueOf(count);
119 | } catch (Exception e) {
120 | e.printStackTrace();
121 | }
122 | if (nubm >= 10000) {
123 | buffer.delete(buffer.length() - 3, buffer.length());
124 | buffer.insert(buffer.length() - 1, ".");
125 | buffer.append("万");
126 | }
127 | System.out.println(buffer);
128 | return buffer.toString();
129 | }
130 |
131 | /**
132 | * @param str 有空字符就返回 true
133 | * @return
134 | */
135 | public static boolean isNull(String str) {
136 | if (str == null || str.trim().equals("")) {
137 | return true;
138 | }
139 | return false;
140 | }
141 |
142 | /**
143 | * @param str 有空字符就返回 true
144 | * @return
145 | */
146 | public static boolean isNull(CharSequence str) {
147 | if (str == null || str.toString() == null || str.toString().trim().equals("")) {
148 | return true;
149 | }
150 | return false;
151 | }
152 |
153 | /**
154 | * @param str 数组中有空字符就返回 true
155 | * @return
156 | */
157 | public static boolean isNulls(String... str) {
158 | for (int i = 0; i < str.length; i++) {
159 | if (str[i] == null || str[i].trim().equals("")) {
160 | return true;
161 | }
162 | }
163 | return false;
164 | }
165 |
166 | public static boolean isMobileNO(String mobiles) {
167 | Pattern p = Pattern
168 | .compile("1([\\d]{10})|((\\+[0-9]{2,4})?\\(?[0-9]+\\)?-?)?[0-9]{7,8}");
169 | Matcher m = p.matcher(mobiles);
170 | return m.matches();
171 | }
172 |
173 | public static String toUtf8(String str) {
174 | try {
175 | return URLEncoder.encode(str, CHARSET_UTF_8);
176 | } catch (UnsupportedEncodingException e) {
177 | try {
178 | return new String(str.getBytes("UTF-8"), "UTF-8");
179 | } catch (UnsupportedEncodingException e1) {
180 | }
181 | }
182 | return str;
183 | }
184 |
185 | public static boolean matchesNmb(String str) {
186 | if (isNull(str)) return false;
187 | return str.matches(".*\\d+.*");
188 | }
189 |
190 | public static String covertUtf8(String str) {
191 | try {
192 | return URLEncoder.encode(str, CHARSET_UTF_8);
193 | } catch (UnsupportedEncodingException e) {
194 | try {
195 | return new String(str.getBytes("UTF-8"), "UTF-8");
196 | } catch (UnsupportedEncodingException e1) {
197 | }
198 | }
199 | return str;
200 | }
201 |
202 | public static boolean isPassword(String password) {
203 | Pattern p = Pattern.compile("^[0-9a-zA-Z _-]+$");
204 | Matcher m = p.matcher(password);
205 | return m.matches();
206 | }
207 |
208 | public static boolean isUserNiCheng(String niCheng) {
209 | String all1 = "^[a-zA-Z0-9_\u4e00-\u9fa5]+$";
210 | Pattern p = Pattern.compile(all1);
211 | Matcher m = p.matcher(niCheng);
212 | return m.matches();
213 | }
214 |
215 |
216 |
217 | /**
218 | * Judge whether a string is whitespace, empty ("") or null.
219 | *
220 | * @param str
221 | * @return
222 | */
223 | public static boolean isEmpty(String str) {
224 | int strLen;
225 | if (str == null || (strLen = str.length()) == 0 || str.equalsIgnoreCase("null")) {
226 | return true;
227 | }
228 | for (int i = 0; i < strLen; i++) {
229 | if ((Character.isWhitespace(str.charAt(i)) == false)) {
230 | return false;
231 | }
232 | }
233 | return true;
234 | }
235 | }
236 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/utils/V.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.utils;
2 |
3 | import android.app.Activity;
4 | import android.view.View;
5 |
6 | /**
7 | * Created by Administrator on 2016/10/19/019.
8 | */
9 |
10 | public class V {
11 |
12 | public static T findV(View view,int id) {
13 | return (T) view.findViewById(id);
14 | }
15 | public static T findV(Activity activity, int id) {
16 | return (T) activity.findViewById(id);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/video/MediaControllerBuffing.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.video;
2 |
3 | import android.view.View;
4 | import android.widget.TextView;
5 |
6 |
7 | import com.yyl.videolist.R;
8 | import com.yyl.videolist.listeners.VideoViewControllerListeners;
9 | import com.yyl.videolist.utils.V;
10 |
11 |
12 | /**
13 | * Created by yyl on 2016/2/17/017.
14 | * 加载进度条控制器
15 | */
16 | public class MediaControllerBuffing implements VideoViewControllerListeners {
17 | View bufferingView;
18 | View video_error_layout;
19 | TextView buffering;
20 |
21 | public MediaControllerBuffing(View layoutRootView) {
22 | bufferingView = V.findV(layoutRootView, R.id.video_buffering_progress);
23 | video_error_layout = V.findV(layoutRootView, R.id.video_error_layout);
24 | buffering = V.findV(layoutRootView, R.id.video_buffering_progress_text);
25 | }
26 |
27 |
28 |
29 | @Override
30 | public boolean isDragging() {
31 | return false;
32 | }
33 |
34 | @Override
35 | public void close() {
36 |
37 | }
38 |
39 | @Override
40 | public void changeLayoutState(int layoutState) {
41 |
42 | }
43 |
44 | @Override
45 | public void show(int time) {
46 |
47 | }
48 |
49 | @Override
50 | public void hide() {
51 |
52 | }
53 |
54 | @Override
55 | public void onProgressUpdate(long current, long duration) {
56 |
57 | }
58 |
59 | @Override
60 | public boolean onSingleTapConfirmed() {
61 | return false;
62 | }
63 |
64 | @Override
65 | public void onDoubleTap() {
66 |
67 | }
68 |
69 |
70 | @Override
71 | public void eventBuffing(int event, float buffing) {
72 | if (buffing==100f) {
73 | buffering.setVisibility(buffing > 0 ? View.VISIBLE : View.GONE);
74 | buffering.setText(buffing + "%");
75 | bufferingView.setVisibility(View.VISIBLE);
76 | } else {
77 | bufferingView.setVisibility(View.GONE);
78 | }
79 | if (video_error_layout.getVisibility() == View.VISIBLE) {
80 | video_error_layout.setVisibility(View.GONE);
81 | }
82 | }
83 |
84 | @Override
85 | public void eventPlayInit(boolean opening) {
86 |
87 | }
88 |
89 | @Override
90 | public void eventStop(boolean isPlayError) {
91 |
92 | }
93 |
94 | @Override
95 | public void eventError(int error, boolean show) {
96 | if (show) {
97 | bufferingView.setVisibility(View.GONE);
98 | video_error_layout.setVisibility(View.VISIBLE);
99 | }
100 | }
101 |
102 | @Override
103 | public void eventPlay(boolean isPlaying) {
104 |
105 | }
106 |
107 | }
108 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/video/MediaControllerSmall.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.video;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.view.View;
6 | import android.view.animation.Animation;
7 | import android.view.animation.AnimationUtils;
8 | import android.widget.ImageButton;
9 | import android.widget.SeekBar;
10 | import android.widget.TextView;
11 |
12 | import com.yyl.videolist.R;
13 | import com.yyl.videolist.listeners.FullScreenControl;
14 | import com.yyl.videolist.listeners.VideoViewControllerListeners;
15 | import com.yyl.videolist.utils.StringUtils;
16 | import com.yyl.videolist.utils.V;
17 |
18 | import org.videolan.vlc.listener.MediaPlayerControl;
19 |
20 | /**
21 | * Created by yyl on 2016/2/16/016.
22 | *
23 | * 小屏播放器 底布局
24 | */
25 | public class MediaControllerSmall implements VideoViewControllerListeners {
26 | private MediaPlayerControl mPlayer;
27 | private long mDuration;
28 |
29 | private boolean mDragging;
30 | private boolean mInstantSeeking = false;
31 |
32 | // @OnClick({R.id.mediacontroller_play_pause_small, R.id.mediacontroller_change_small, R.id.mediacontroller_projection_small})
33 |
34 |
35 | public void onProgressUpdate(long current, long duration) {
36 | updatePausePlay();
37 | setProgress();
38 | }
39 |
40 | @Override
41 | public boolean onSingleTapConfirmed() {
42 | return false;
43 | }
44 |
45 | @Override
46 | public void onDoubleTap() {
47 |
48 | }
49 |
50 |
51 | private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() {
52 | public void onStartTrackingTouch(SeekBar bar) {
53 | mDragging = true;
54 | }
55 |
56 | public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) {
57 | if (!fromuser)
58 | return;
59 | long newposition = (mDuration * progress) / 1000;
60 | String time = StringUtils.generateTime(newposition);
61 | if (mInstantSeeking)
62 | mPlayer.seekTo((int)newposition);
63 | if (mCurrentTime != null)
64 | mCurrentTime.setText(time);
65 | }
66 |
67 | public void onStopTrackingTouch(SeekBar bar) {
68 | if (!mInstantSeeking)
69 | mPlayer.seekTo((int)(mDuration * bar.getProgress()) / 1000);
70 | mDragging = false;
71 | }
72 | };
73 | SeekBar mProgress;
74 | TextView mEndTime;
75 | TextView mCurrentTime;
76 | View down_layout;
77 | ImageButton mPauseButton;
78 | View conterLayout;
79 |
80 | public MediaControllerSmall(final Activity activity, View layoutRootView, MediaPlayerControl player, final FullScreenControl fullScreenControl) {
81 | this.mPlayer = player;
82 | mProgress = V.findV(layoutRootView, R.id.mediacontroller_seekbar_small);
83 | mEndTime = V.findV(layoutRootView, R.id.mediacontroller_time_total_small);
84 | mCurrentTime = V.findV(layoutRootView, R.id.mediacontroller_time_current_small);
85 | down_layout = V.findV(layoutRootView, R.id.mediacontroller_down_layout_small);
86 | mPauseButton = V.findV(layoutRootView, R.id.mediacontroller_play_pause_small);
87 | conterLayout = V.findV(layoutRootView, R.id.mediacontroller_conter_bg);
88 | V.findV(layoutRootView, R.id.mediacontroller_change_small).setOnClickListener(new View.OnClickListener() {
89 | @Override
90 | public void onClick(View v) {
91 | fullScreenControl.setFullscreen(activity, !fullScreenControl.isFullScreen());
92 | }
93 | });
94 | mPauseButton.setOnClickListener(new View.OnClickListener() {
95 | @Override
96 | public void onClick(View v) {
97 | doPauseResume();
98 | fullScreenControl.clickEvent();
99 | }
100 | });
101 |
102 |
103 | initView();
104 | }
105 |
106 | public T findV(View view, int id) {
107 | return (T) view.findViewById(id);
108 | }
109 |
110 | private void initView() {
111 | mEndTime.getPaint().setTextSkewX(-0.25f);
112 | mCurrentTime.getPaint().setTextSkewX(-0.25f);
113 | updatePausePlay();
114 | mProgress.setOnSeekBarChangeListener(mSeekListener);
115 | mProgress.setPadding(0, 0, 0, 0);
116 | mProgress.setMax(1000);
117 | mProgress.setThumbOffset(0);
118 | }
119 |
120 |
121 | /**
122 | * @param seekWhenDragging false拖动完成后加载进度 ture拖动中加载进度
123 | */
124 | public void setInstantSeeking(boolean seekWhenDragging) {
125 | mInstantSeeking = seekWhenDragging;
126 | }
127 |
128 |
129 | private boolean mShowing;
130 |
131 | @Override
132 | public void show(int time) {
133 | if (mShowing) {
134 | return;
135 | }
136 | mShowing = true;
137 | startOpenAnimation(mPauseButton.getContext());
138 | }
139 |
140 | @Override
141 | public void close() {
142 | mShowing = false;
143 | down_layout.setVisibility(View.GONE);
144 | conterLayout.setVisibility(View.GONE);
145 | }
146 |
147 | @Override
148 | public boolean isDragging() {
149 | return mDragging;
150 | }
151 |
152 | @Override
153 | public void changeLayoutState(int layoutState) {
154 |
155 | }
156 |
157 |
158 | public void hide() {
159 | if (mShowing) {
160 | mShowing = false;
161 | startHideAnimation(mPauseButton.getContext());
162 | }
163 |
164 | }
165 |
166 |
167 | private void startOpenAnimation(Context mContext) {
168 | if (down_layout.getVisibility() != View.VISIBLE) {
169 | down_layout.setVisibility(View.VISIBLE);
170 | }
171 | if (conterLayout.getVisibility() != View.VISIBLE) {
172 | conterLayout.setVisibility(View.VISIBLE);
173 | }
174 |
175 | Animation in_from_fade = AnimationUtils.loadAnimation(down_layout.getContext(), R.anim.in_from_fade);
176 | conterLayout.clearAnimation();
177 | conterLayout.startAnimation(in_from_fade);
178 |
179 | Animation anima = AnimationUtils.loadAnimation(mContext, R.anim.in_from_down);
180 | down_layout.startAnimation(anima);
181 | }
182 |
183 |
184 | private void startHideAnimation(Context mContext) {
185 |
186 | Animation out_from_fade = AnimationUtils.loadAnimation(mContext, R.anim.out_from_fade);
187 | conterLayout.clearAnimation();
188 | conterLayout.startAnimation(out_from_fade);
189 |
190 | Animation out_from_down = AnimationUtils.loadAnimation(mContext, R.anim.out_from_down);
191 | out_from_down.setAnimationListener(animationListener);
192 | down_layout.startAnimation(out_from_down);
193 | }
194 |
195 | private Animation.AnimationListener animationListener = new Animation.AnimationListener() {
196 | @Override
197 | public void onAnimationStart(Animation animation) {
198 | }
199 |
200 | @Override
201 | public void onAnimationEnd(Animation animation) {
202 | down_layout.setVisibility(View.GONE);
203 | conterLayout.setVisibility(View.GONE);
204 | }
205 |
206 | @Override
207 | public void onAnimationRepeat(Animation animation) {
208 |
209 | }
210 | };
211 |
212 | public boolean isShowing() {
213 | return mShowing;
214 | }
215 |
216 |
217 | private long setProgress() {
218 | if (!mShowing || mDragging)
219 | return 0;
220 | long position = mPlayer.getCurrentPosition();
221 | long duration = mPlayer.getDuration();
222 | if (mProgress != null) {
223 | if (duration > 0) {
224 | long pos = 1000L * position / duration;
225 | mProgress.setProgress((int) pos);
226 | }
227 | // int percent = mPlayer.getBufferPercentage();
228 | // mProgress.setSecondaryProgress(percent * 10);
229 | }
230 | mDuration = duration;
231 | if (mEndTime != null)
232 | mEndTime.setText(StringUtils.generateTime(mDuration));
233 | if (mCurrentTime != null)
234 | mCurrentTime.setText(StringUtils.generateTime(position));
235 | return position;
236 | }
237 |
238 |
239 | private void updatePausePlay() {
240 | if (mPauseButton == null)
241 | return;
242 | if (mPlayer.isPlaying()) {
243 | mPauseButton.setSelected(true);
244 | } else {
245 | mPauseButton.setSelected(false);
246 | }
247 |
248 | }
249 |
250 | private void doPauseResume() {
251 | if (mPlayer.isPlaying()) {
252 | mPlayer.pause();
253 | } else {
254 | mPlayer.start();
255 | }
256 | updatePausePlay();
257 | }
258 |
259 |
260 | public void setEnabled(boolean enabled) {
261 | if (mPauseButton != null)
262 | mPauseButton.setEnabled(enabled);
263 | if (mProgress != null)
264 | mProgress.setEnabled(enabled);
265 |
266 | }
267 |
268 | public void setSmallState() {
269 | smallState = true;
270 | // projection_small.setVisibility(View.GONE);
271 | // change_small.setVisibility(View.GONE);
272 | conterLayout.setVisibility(View.GONE);
273 | close();
274 | }
275 |
276 | boolean smallState;
277 |
278 |
279 | @Override
280 | public void eventBuffing(int event, float buffing) {
281 |
282 | }
283 |
284 | @Override
285 | public void eventPlayInit(boolean opening) {
286 |
287 | }
288 |
289 | @Override
290 | public void eventStop(boolean isPlayError) {
291 |
292 | }
293 |
294 | @Override
295 | public void eventError(int error, boolean show) {
296 |
297 | }
298 |
299 | @Override
300 | public void eventPlay(boolean isPlaying) {
301 |
302 | }
303 |
304 | }
305 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/video/MediaControllerTouch.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.video;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.Activity;
5 | import android.content.Context;
6 | import android.os.Handler;
7 | import android.os.Message;
8 | import android.view.GestureDetector;
9 | import android.view.MotionEvent;
10 | import android.view.View;
11 | import android.widget.ImageView;
12 | import android.widget.TextView;
13 |
14 | import com.yyl.videolist.MyVideoView;
15 | import com.yyl.videolist.R;
16 | import com.yyl.videolist.listeners.VideoViewListeners;
17 | import com.yyl.videolist.listeners.VideoViewTouchListeners;
18 | import com.yyl.videolist.utils.StringUtils;
19 | import com.yyl.videolist.utils.V;
20 |
21 | import org.videolan.vlc.listener.MediaPlayerControl;
22 |
23 |
24 | /**
25 | * Created by yyl on 2016/2/17/017.
26 | * 快进快退方向控制
27 | * 点击事件监听
28 | */
29 | public class MediaControllerTouch implements VideoViewTouchListeners {
30 |
31 | ImageView speed_direction;
32 | View speedLayout;
33 | TextView speedTime;
34 |
35 |
36 | private long newposition;
37 | private boolean isMove = false;
38 | private float move = 0;
39 | private GestureDetector mGestureDetector;
40 |
41 | private final MediaPlayerControl mPlayer;
42 | private VideoViewListeners videolistener;
43 | private boolean isSmallMini;
44 |
45 | private boolean isNullLayout;//什么都不显示
46 |
47 | private boolean stateList;
48 | private boolean isError;
49 | private boolean isFullscreen;
50 | @SuppressLint("HandlerLeak")
51 | Handler handlerVisiable = new Handler() {
52 | @Override
53 | public void handleMessage(Message msg) {
54 | if (speedLayout != null)
55 | speedLayout.setVisibility(View.GONE);
56 | }
57 | };
58 |
59 | public MediaControllerTouch(View layoutRootView, MyVideoView mPlayer, VideoViewListeners videolistener) {
60 | this.mPlayer = mPlayer;
61 | this.videolistener = videolistener;
62 | speed_direction = V.findV(layoutRootView, R.id.mediacontroller_speed_direction);
63 | speedLayout = V.findV(layoutRootView, R.id.mediacontroller_speed_layout);
64 | speedTime = V.findV(layoutRootView, R.id.mediacontroller_speed_text);
65 |
66 | initView(layoutRootView.getContext());
67 | setOnScreenTouchSpeed(mPlayer);
68 | }
69 |
70 | @Override
71 | public void changeLayoutState(int layoutState) {
72 | switch (layoutState) {
73 | case stateSmallFull:
74 |
75 | break;
76 | case stateFull:
77 | isFullscreen = true;
78 | break;
79 | case stateSmallList:
80 | stateList = true;
81 | break;
82 | case stateNull:
83 | isNullLayout = true;
84 | break;
85 |
86 | }
87 | }
88 |
89 | @Override
90 | public void setFullscreen(Activity activity, boolean isFullscreen) {
91 | this.isFullscreen = isFullscreen;
92 | }
93 |
94 | private void initView(Context mContext) {
95 | mGestureDetector = new GestureDetector(mContext, new MyGestureListener());
96 | speedLayout.setVisibility(View.GONE);
97 | }
98 |
99 | public void setError(boolean error) {
100 | isError = error;
101 | }
102 |
103 |
104 | /**
105 | * 快进快退的父控件
106 | *
107 | * @param view
108 | */
109 | private void setOnScreenTouchSpeed(View view) {
110 | view.setOnTouchListener(new View.OnTouchListener() {
111 | @Override
112 | public boolean onTouch(View v, MotionEvent event) {
113 | if (isSmallMini) return true;
114 | if (isNullLayout) return true;
115 | if (isError) return true;
116 | if (event.getAction() == MotionEvent.ACTION_UP) {
117 | boolean isresult = mGestureDetector.onTouchEvent(event);
118 | if (!isresult && isMove && mPlayer != null) {
119 | mPlayer.seekTo((int)newposition);
120 | setSpeedVisibiliy(false);
121 | }
122 | return isresult;
123 | } else {
124 | return mGestureDetector.onTouchEvent(event);
125 | }
126 |
127 | }
128 | });
129 | }
130 |
131 |
132 | private void setSpeedVisibiliy(boolean visibiliy) {
133 | if (visibiliy && speedLayout.getVisibility() != View.VISIBLE) {
134 | speedLayout.setVisibility(View.VISIBLE);
135 | handlerVisiable.removeMessages(0);
136 | handlerVisiable.sendEmptyMessageDelayed(0, 1000);
137 | } else if (!visibiliy && speedLayout.getVisibility() == View.VISIBLE) {
138 | speedLayout.postDelayed(new Runnable() {
139 | @Override
140 | public void run() {
141 | speedLayout.setVisibility(View.GONE);
142 | }
143 | }, 300);
144 | }
145 | }
146 |
147 | private void setSpeedTimelayout(float move) {
148 | if (!isCanCuntroll() || !isFullscreen) {
149 | return;
150 | }
151 | isMove = true;
152 | if (move > 0) {
153 | speed_direction.setSelected(true);
154 | } else {
155 | speed_direction.setSelected(false);
156 | }
157 | long progress = mPlayer.getCurrentPosition();
158 | long moveLimit = progress + ((long) (move * 40));
159 | long count = mPlayer.getDuration();
160 | moveLimit = moveLimit > 0 ? moveLimit > count ? count : moveLimit : 0;
161 | //总位置数乘 现在位置百分比
162 | newposition = moveLimit;
163 | String time = StringUtils.generateTime(newposition);
164 | String time2 = StringUtils.generateTime(count);
165 | speedTime.setText(time + " / " + time2);
166 | setSpeedVisibiliy(true);
167 | }
168 |
169 | private boolean isCanCuntroll() {
170 | return mPlayer != null && mPlayer.getDuration() > 1;
171 | }
172 |
173 | public void changeMiniScaleState(boolean isSmallMini) {
174 | this.isSmallMini = isSmallMini;
175 | }
176 |
177 |
178 | private class MyGestureListener extends GestureDetector.SimpleOnGestureListener {
179 |
180 |
181 | @Override
182 | public boolean onDown(MotionEvent e) {
183 | isMove = false;
184 | move = 0;
185 | return true;
186 | }
187 |
188 | @Override
189 | public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
190 | move = e2.getX() - e1.getX();
191 | setSpeedTimelayout(move);
192 | return true;
193 | }
194 |
195 |
196 | //单击
197 | @Override
198 | public boolean onSingleTapConfirmed(MotionEvent e) {
199 | videolistener.onSingleTapConfirmed();
200 | return true;
201 | }
202 |
203 | //双击了
204 | @Override
205 | public boolean onDoubleTap(MotionEvent e) {
206 | videolistener.onDoubleTap();
207 | return true;
208 | }
209 |
210 |
211 | }
212 | }
213 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/video/MySensorListener.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.video;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.hardware.Sensor;
6 | import android.hardware.SensorEvent;
7 | import android.hardware.SensorEventListener;
8 | import android.hardware.SensorManager;
9 | import android.os.Handler;
10 | import android.os.Message;
11 |
12 | /**
13 | * Created by yyl on 2015/11/26/026.
14 | */
15 | public class MySensorListener{
16 |
17 | private SensorManager mManager;
18 | private Sensor mSensor = null;
19 | private boolean isChange = false;
20 | private static boolean lock = false;
21 |
22 | public MySensorListener(Context context) {
23 | mManager = (SensorManager) context
24 | .getSystemService(Context.SENSOR_SERVICE);
25 | mSensor = mManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
26 | }
27 |
28 | public static boolean isLock() {
29 | return lock;
30 | }
31 |
32 | public static void setLock(boolean lock) {
33 | MySensorListener.lock = lock;
34 | }
35 |
36 | public void onResume() {
37 | /*
38 | * 一个服务可能有多个Sensor实现,此处调用getDefaultSensor获取默认的Sensor 参数3 :模式 可选数据变化的刷新频率
39 | */
40 | if (mManager != null) {
41 | mManager.registerListener(myAccelerometerListener, mSensor,
42 | SensorManager.SENSOR_DELAY_NORMAL);
43 | }
44 | }
45 |
46 | public void onPause() {
47 | handler.removeMessages(landscape);
48 | handler.removeMessages(portrait);
49 | /*
50 | * onPause方法中关闭触发器,否则讲耗费用户大量电量,
51 | */
52 | if (myAccelerometerListener != null && mManager != null) {
53 | mManager.unregisterListener(myAccelerometerListener);
54 | }
55 | }
56 | private final static int portrait = 1;
57 | private final static int landscape = 2;
58 |
59 | @SuppressLint("HandlerLeak")
60 | Handler handler = new Handler() {
61 | @Override
62 | public void handleMessage(Message msg) {
63 | try {
64 | switch (msg.what) {
65 | case portrait:
66 | if (sensorLandspace != null && !isLock()) {
67 | boolean change1 = sensorLandspace.changeScreen(false);
68 | if (!change1) {
69 | isChange = !isChange;
70 | }
71 | }
72 | break;
73 | case landscape:
74 | if (sensorLandspace != null) {
75 | boolean change = sensorLandspace.changeScreen(true);
76 | if (!change) {
77 | isChange = !isChange;
78 | }
79 | }
80 | break;
81 | }
82 | } catch (Exception e) {
83 | e.printStackTrace();
84 | }
85 | }
86 | };
87 | ScreenChangeSensorLandspace sensorLandspace;
88 | //ScreenChangeSensorPortrait sensorPortrait;
89 |
90 | public void setSensorLandspace(ScreenChangeSensorLandspace sensorLandspace) {
91 | this.sensorLandspace = sensorLandspace;
92 | }
93 |
94 | public void setSensorPortrait(ScreenChangeSensorPortrait sensorPortrait) {
95 | // this.sensorPortrait = sensorPortrait;
96 | }
97 |
98 | public interface ScreenChangeSensorLandspace {
99 | boolean changeScreen(boolean isFullSceen);
100 | }
101 |
102 | public interface ScreenChangeSensorPortrait {
103 | boolean changeScreen();
104 | }
105 |
106 | String TAG = "yyl";
107 | /*
108 | * SensorEventListener接口的实现,需要实现两个方法 方法1 onSensorChanged 当数据变化的时候被触发调用 方法2
109 | * onAccuracyChanged 当获得数据的精度发生变化的时候被调用,比如突然无法获得数据时
110 | */
111 | private SensorEventListener myAccelerometerListener = new SensorEventListener() {
112 |
113 | // 复写onSensorChanged方法
114 | public void onSensorChanged(SensorEvent sensorEvent) {
115 | if (sensorEvent.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
116 | float x = sensorEvent.values[0];//x是9的时候手机右侧最上面 向上
117 | float y = sensorEvent.values[1];// y是9的时候是手机(听筒)最上面 -9相反
118 | float z = sensorEvent.values[2];// z是9的时候屏幕重力向上 对着人脸
119 | // Log.i(TAG, "\n X=" + x);
120 | // Log.i(TAG, "\n Y= " + y);
121 | // Log.i(TAG, "\n Z= " + z);
122 | if (y > 7.1f) {//竖屏
123 | if (!isLock() && isChange) {
124 | isChange = false;
125 | handler.removeMessages(landscape);
126 | handler.sendEmptyMessageDelayed(portrait, 500);
127 |
128 | }
129 | } else if (y < 3f && y > -3f) {//横屏
130 | if (x > 5f || x < -5f) {
131 | if (!isLock() && !isChange) {
132 | isChange = true;
133 | handler.removeMessages(portrait);
134 | handler.sendEmptyMessageDelayed(landscape, 500);
135 |
136 | }
137 | }
138 | }
139 | }
140 | }
141 |
142 | // 复写onAccuracyChanged方法
143 | public void onAccuracyChanged(Sensor sensor, int accuracy) {
144 | }
145 | };
146 |
147 |
148 | }
149 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/video/VlcMediaController.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.video;
2 |
3 |
4 | import org.videolan.vlc.listener.MediaListenerEvent;
5 | import org.videolan.vlc.listener.MediaPlayerControl;
6 |
7 | /**
8 | * Created by yuyunlong on 2016/8/12/012.
9 | */
10 | public class VlcMediaController extends VlcMediaControllerBase implements MediaListenerEvent {
11 |
12 | public VlcMediaController(MediaPlayerControl mediaPlayerControl) {
13 | super(mediaPlayerControl);
14 | }
15 |
16 | boolean isShowLoading;
17 |
18 | public void onAttachedToWindow() {
19 | isResume = true;
20 | }
21 |
22 | public void onDetachedFromWindow() {
23 | isResume = false;
24 | }
25 |
26 |
27 | @Override
28 | public void eventBuffing(final int event, final float buffing) {
29 | if (isResume) {
30 | isShowLoading = buffing==100f;
31 | mHandler.post(new Runnable() {
32 | @Override
33 | public void run() {
34 | buffingLayout.eventBuffing(event, buffing);
35 | }
36 | });
37 |
38 | }
39 | }
40 |
41 | @Override
42 | public void eventPlayInit(boolean opening) {
43 | if (!opening) {
44 | smallLayout.close();
45 | fullLayout.close();
46 | }
47 | mediaTouch.setError(false);
48 | }
49 |
50 | @Override
51 | public void eventStop(boolean isPlayError) {
52 | if (isResume) {
53 | mHandler.post(new Runnable() {
54 | @Override
55 | public void run() {
56 |
57 | }
58 | });
59 | }
60 | }
61 |
62 | @Override
63 | public void eventError(final int error, final boolean show) {
64 | if (isResume) {
65 | mHandler.post(new Runnable() {
66 | @Override
67 | public void run() {
68 | closeAll();
69 | buffingLayout.eventError(error, show);
70 | mediaTouch.setError(show);
71 | }
72 | });
73 |
74 | }
75 | }
76 |
77 |
78 | @Override
79 | public void eventPlay(boolean isPlaying) {
80 |
81 | }
82 |
83 |
84 |
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/video/VlcMediaControllerBase.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.video;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.Activity;
5 | import android.content.pm.ActivityInfo;
6 | import android.os.Handler;
7 | import android.os.Message;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.view.WindowManager;
11 | import android.widget.FrameLayout;
12 |
13 | import com.yyl.videolist.demo.VideoControllerDemo;
14 | import com.yyl.videolist.listeners.FullScreenControl;
15 | import com.yyl.videolist.listeners.MediaPlayerChangeState;
16 | import com.yyl.videolist.listeners.VideoViewControllerListeners;
17 | import com.yyl.videolist.listeners.VideoViewListeners;
18 | import com.yyl.videolist.listeners.VideoViewTouchListeners;
19 |
20 | import org.videolan.vlc.listener.MediaPlayerControl;
21 |
22 | /**
23 | * Created by yuyunlong on 2016/8/13/013.
24 | */
25 | public abstract class VlcMediaControllerBase implements FullScreenControl, VideoViewListeners, MediaPlayerChangeState {
26 | protected int currentState = -1;
27 | protected VideoViewControllerListeners fullLayout;
28 | protected VideoViewControllerListeners smallLayout;
29 | protected VideoViewControllerListeners buffingLayout;
30 | protected VideoViewTouchListeners mediaTouch;
31 | private FullScreenControl fullScreenControl;
32 | protected MediaPlayerControl mPlayer;
33 |
34 | protected boolean mShowing;
35 | protected static final int FADE_OUT = 1;
36 | protected static final int SHOW_PROGRESS = 2;
37 |
38 | protected boolean isResume;
39 | private View rootView;
40 | private boolean isAnchor;
41 |
42 | public VlcMediaControllerBase(MediaPlayerControl mPlayer) {
43 | this.mPlayer = mPlayer;
44 | fullLayout = new VideoControllerDemo();
45 | smallLayout = new VideoControllerDemo();
46 | }
47 |
48 | public void setRootView(View rootView) {
49 | this.rootView = rootView;
50 | }
51 |
52 | public void setFullScreenControl(FullScreenControl fullScreenControl) {
53 | this.fullScreenControl = fullScreenControl;
54 | }
55 |
56 |
57 | public boolean isAnchor() {
58 | return isAnchor;
59 | }
60 |
61 | public void setAnchor() {
62 | isAnchor = true;
63 | }
64 |
65 | public void setBuffingLayout(VideoViewControllerListeners buffingLayout) {
66 | this.buffingLayout = buffingLayout;
67 | }
68 |
69 | public void setSmallLayout(VideoViewControllerListeners smallLayout) {
70 | this.smallLayout = smallLayout;
71 | }
72 |
73 | public void setFullLayout(VideoViewControllerListeners fullLayout) {
74 | this.fullLayout = fullLayout;
75 | }
76 |
77 | public void setTouch(VideoViewTouchListeners mediaTouch) {
78 | this.mediaTouch = mediaTouch;
79 | }
80 |
81 | public void anchorRootView(FrameLayout frameLayout) {
82 | if (rootView.getParent() != null) {
83 | ((ViewGroup) rootView.getParent()).removeView(rootView);
84 | }
85 | frameLayout.addView(rootView);
86 | }
87 |
88 | public void removeRootView() {
89 | if (rootView.getParent() != null) {
90 | ((ViewGroup) rootView.getParent()).removeView(rootView);
91 | }
92 | }
93 |
94 |
95 | @SuppressLint("HandlerLeak")
96 | final Handler mHandler = new Handler() {
97 | @Override
98 | public void handleMessage(Message msg) {
99 | if (!isResume) return;
100 | switch (msg.what) {
101 | case FADE_OUT:
102 | if (isDragging()) {
103 | sendEmptyMessageDelayed(FADE_OUT, 3000);
104 | } else {
105 | hide();
106 | }
107 | break;
108 | case SHOW_PROGRESS:
109 | long pos = mPlayer.getCurrentPosition();
110 | if (!isDragging() && mShowing) {
111 | onProgressUpdate(pos, pos);
112 | }
113 | if (mShowing) {
114 | msg = obtainMessage(SHOW_PROGRESS);
115 | sendMessageDelayed(msg, 1000 - (pos % 1000));
116 | } else {
117 | removeMessages(SHOW_PROGRESS);
118 | }
119 | break;
120 | }
121 | }
122 | };
123 |
124 | //是否按下了进度条
125 | private boolean isDragging() {
126 | return smallLayout.isDragging() || fullLayout.isDragging();
127 | }
128 |
129 |
130 | private boolean isFullState;
131 |
132 | @Override
133 | public boolean isFullScreen() {
134 | return isFullState;
135 | }
136 |
137 | @Override
138 | public void setFullscreen(Activity activity, boolean isFullscreen) {
139 | this.isFullState = isFullscreen;
140 | if (isFullscreen) {
141 | activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
142 | activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
143 | } else {
144 | activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
145 | activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
146 | }
147 | if (fullScreenControl != null)
148 | fullScreenControl.setFullscreen(activity, isFullscreen);
149 | if (mediaTouch != null)
150 | mediaTouch.setFullscreen(activity, isFullscreen);
151 | }
152 |
153 | private void show() {
154 | show(5000);
155 | }
156 |
157 |
158 | @Override
159 | public void show(int timeout) {
160 | if (!mShowing) {
161 | mShowing = true;
162 | mHandler.sendEmptyMessage(SHOW_PROGRESS);
163 | smallLayout.show(timeout);
164 | }
165 | if (timeout != 0) {
166 | mHandler.removeMessages(FADE_OUT);
167 | mHandler.sendMessageDelayed(mHandler.obtainMessage(FADE_OUT), timeout);
168 | }
169 | }
170 |
171 | @Override
172 | public void hide() {
173 | mShowing = false;
174 | smallLayout.hide();
175 | }
176 |
177 |
178 | @Override
179 | public void onProgressUpdate(long current, long duration) {
180 | smallLayout.onProgressUpdate(current, duration);
181 | }
182 |
183 | @Override
184 | public boolean clickEvent() {
185 | show();
186 | return false;
187 | }
188 |
189 | @Override
190 | public boolean onSingleTapConfirmed() {
191 | if (mShowing) {
192 | hide();
193 | } else {
194 | show();
195 | }
196 | return false;
197 | }
198 |
199 |
200 | @Override
201 | public void onDoubleTap() {
202 | boolean prepare = mPlayer.isPrepare();
203 | if (prepare && mPlayer.isPlaying()) {
204 | mPlayer.pause();
205 | } else if (prepare) {
206 | mPlayer.start();
207 | }
208 | }
209 |
210 | protected void closeAll() {
211 | mShowing = false;
212 | smallLayout.close();
213 | }
214 |
215 | private void closeSmall() {
216 | mShowing = false;
217 | smallLayout.close();
218 | }
219 |
220 | @Override
221 | public void changeLayoutState(int layoutState) {
222 | currentState = layoutState;
223 | mediaTouch.changeLayoutState(layoutState);
224 | smallLayout.changeLayoutState(layoutState);
225 | fullLayout.changeLayoutState(layoutState);
226 | }
227 | }
228 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/video/VlcMediaView.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.video;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.media.AudioManager;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.util.AttributeSet;
8 | import android.util.Log;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 |
12 | import com.yyl.videolist.MyVideoView;
13 | import com.yyl.videolist.R;
14 | import com.yyl.videolist.listeners.MediaPlayerChangeState;
15 | import com.yyl.videolist.utils.LogUtils;
16 |
17 | /**
18 | * Created by yyl on 2016/10/12/012.
19 | */
20 |
21 | public class VlcMediaView extends VlcVideoViewImpl {
22 | String tag = "VlcVideoView";
23 |
24 | private VlcMediaController controller;
25 | private boolean isStop = true;
26 | private MyVideoView videoPlayer;
27 |
28 | public VlcMediaView(Context context) {
29 | super(context);
30 | initView(context);
31 | }
32 |
33 | public VlcMediaView(Context context, AttributeSet attrs) {
34 | super(context, attrs);
35 | initView(context);
36 | }
37 |
38 | public VlcMediaView(Context context, AttributeSet attrs, int defStyleAttr) {
39 | super(context, attrs, defStyleAttr);
40 | initView(context);
41 | }
42 |
43 | protected void initView(Context context) {
44 | LayoutInflater.from(context).inflate(R.layout.video_list_controller, this);
45 | videoPlayer = findV(R.id.vlc_video_view1);
46 | controller = new VlcMediaController(videoPlayer);
47 | }
48 |
49 | @Override
50 | public boolean isFullState() {
51 | return controller.isFullScreen();
52 | }
53 |
54 | @Override
55 | public boolean onBackPressed(Activity activity) {
56 | if (isFullState() && layoutState != MediaPlayerChangeState.stateFull) {
57 | controller.setFullscreen(activity, false);
58 | return true;
59 | }
60 | return false;
61 | }
62 |
63 | private int layoutState = MediaPlayerChangeState.stateSmallFull;
64 |
65 | public void changeLayoutState(int layoutState) {
66 | this.layoutState = layoutState;
67 | }
68 |
69 | private void initController() {
70 | if (controller.isAnchor()) return;
71 | controller.setBuffingLayout(new MediaControllerBuffing(this));
72 | controller.setSmallLayout(new MediaControllerSmall(activity, this, videoPlayer, controller));
73 | //controller.setFullLayout(new MediaControllerSmall(activity, this, videoPlayer, controller));
74 | controller.setTouch(new MediaControllerTouch(this, videoPlayer, controller));
75 | controller.changeLayoutState(layoutState);
76 | }
77 |
78 |
79 | @Override
80 | protected void onAttachedToWindow() {
81 | super.onAttachedToWindow();
82 | controller.onAttachedToWindow();
83 | }
84 |
85 | @Override
86 | public void onAttached(RecyclerView recyclerView) {
87 | super.onAttached(recyclerView);
88 | changeLayoutState(MediaPlayerChangeState.stateSmallList);
89 | }
90 |
91 | @Override
92 | protected void onDetachedFromWindow() {
93 | super.onDetachedFromWindow();
94 | controller.onDetachedFromWindow();
95 | }
96 |
97 | @Override
98 | public void playVideo(String path) {
99 | initController();
100 | videoPlayer.setMediaListenerEvent(controller);
101 | controller.setAnchor();
102 | AudioManager am = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
103 | am.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
104 | setVisibility(VISIBLE);
105 | videoPlayer.startPlay(path);
106 | isStop = false;
107 | }
108 |
109 | @Override
110 | public void stopVideo(boolean visiable) {
111 | Log.i(tag, "stopVideo isStop=" + isStop + " visiable=" + visiable);
112 | if (!isStop && videoPlayer != null) {
113 | isStop = true;
114 | videoPlayer.onStop();
115 | if (layoutState == MediaPlayerChangeState.stateSmallList) {
116 | setVisibility(INVISIBLE);
117 | }
118 | }
119 |
120 | }
121 |
122 |
123 | public void saveState() {
124 | videoPlayer.saveState();
125 | }
126 |
127 | @Override
128 | protected void onVisibilityChanged(View changedView, int visibility) {
129 | super.onVisibilityChanged(changedView, visibility);
130 | if (isInEditMode()) {
131 | return;
132 | }
133 | if (visibility == GONE) {
134 | LogUtils.i(tag, "GONE");
135 | stopVideo(false);
136 | } else if (visibility == INVISIBLE) {
137 | LogUtils.i(tag, "INVISIBLE");
138 | stopVideo(false);
139 | }
140 | }
141 |
142 | public T findV(int id) {
143 | return (T) findViewById(id);
144 | }
145 |
146 |
147 | }
--------------------------------------------------------------------------------
/vlcplayer/src/main/java/com/yyl/videolist/video/VlcVideoViewImpl.java:
--------------------------------------------------------------------------------
1 | package com.yyl.videolist.video;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.res.Configuration;
6 | import android.support.v4.view.ViewPager;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.util.AttributeSet;
9 | import android.util.Log;
10 | import android.view.View;
11 |
12 | import com.yyl.videolist.FrameLayoutScale;
13 | import com.yyl.videolist.listeners.VideoViewDetachedEvent;
14 | import com.yyl.videolist.utils.LogUtils;
15 |
16 | import java.util.ArrayList;
17 |
18 | /**
19 | * Created by yyl on 2016/10/19/019.
20 | */
21 |
22 | public abstract class VlcVideoViewImpl extends FrameLayoutScale implements VideoViewDetachedEvent, ViewPager.OnPageChangeListener, View.OnAttachStateChangeListener {
23 | private static final ArrayList videoListDetache = new ArrayList();
24 | private int translationY = -1;
25 | private int startLocationY = -1;
26 | private View currentPlayView;
27 | private boolean isAttach;
28 | public String tag = "VideoViewImpl";
29 |
30 | public VlcVideoViewImpl(Context context) {
31 | super(context);
32 | }
33 |
34 | public VlcVideoViewImpl(Context context, AttributeSet attrs) {
35 | super(context, attrs);
36 | }
37 |
38 | public VlcVideoViewImpl(Context context, AttributeSet attrs, int defStyleAttr) {
39 | super(context, attrs, defStyleAttr);
40 | }
41 |
42 | protected void addEvent(VideoViewDetachedEvent event) {
43 | if (!videoListDetache.contains(event))
44 | videoListDetache.add(event);
45 | }
46 |
47 | protected void removeEvent(VideoViewDetachedEvent event) {
48 | if (videoListDetache.contains(event))
49 | videoListDetache.remove(event);
50 | }
51 |
52 | /**
53 | * 没有可活动的窗口就回收掉
54 | */
55 | public static void detachedWindowEvent() {
56 | for (VideoViewDetachedEvent detache : videoListDetache) {
57 | detache.detachedEvent();
58 | }
59 | }
60 |
61 |
62 | @Override
63 | protected void onConfigurationChanged(Configuration newConfig) {
64 | super.onConfigurationChanged(newConfig);
65 | setScaleFull(isFullState());
66 | }
67 |
68 |
69 | @Override
70 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
71 | super.onLayout(changed, left, top, right, bottom);
72 | if (changed) {
73 | if (isFullState()) {
74 | setTranslationY(0);
75 | } else {
76 | if (translationY != -1)
77 | setTranslationY(translationY);
78 | }
79 | }
80 | }
81 |
82 | protected Activity activity;
83 |
84 | public void onAttached(Activity activity) {
85 | this.activity = activity;
86 | }
87 |
88 | public void onAttached(RecyclerView recyclerView) {
89 | recyclerView.addOnScrollListener(recyclerListener);
90 | }
91 |
92 |
93 | public void onAttached(ViewPager viewPager) {
94 | viewPager.addOnPageChangeListener(this);
95 | }
96 |
97 | public void detached(ViewPager viewPager) {
98 | viewPager.removeOnPageChangeListener(this);
99 | }
100 |
101 | public void detached(RecyclerView recyclerView) {
102 | recyclerView.removeOnScrollListener(recyclerListener);
103 | }
104 |
105 | /**
106 | * 初始化开始的位置
107 | */
108 | private void initTranslation(View playView) {
109 | setTranslationY(0);
110 | setTranslationX(0);
111 | setVisibility(VISIBLE);
112 | int[] location = new int[2];
113 | playView.getLocationInWindow(location);
114 | // int viewX = location[0];
115 | int viewY = location[1];
116 | if (startLocationY == -1) {
117 | getLocationInWindow(location);
118 | // startLocationX = location[0];
119 | startLocationY = location[1];
120 | }
121 | Log.i("yyl", "startLocationY=" + startLocationY + " viewY=" + viewY);
122 | translationY = viewY - startLocationY;
123 | setTranslationY((float) translationY);
124 | }
125 |
126 |
127 | public void onClickViewPlay(View playView, String path) {
128 | initTranslation(playView);
129 | if (currentPlayView != null) {
130 | currentPlayView.removeOnAttachStateChangeListener(this);
131 | currentPlayView = null;
132 | }
133 | currentPlayView = playView;
134 | currentPlayView.addOnAttachStateChangeListener(this);
135 | playVideo(path);
136 | }
137 |
138 | public abstract void playVideo(String path);
139 |
140 | public abstract void stopVideo(boolean visiable);
141 |
142 | public abstract boolean isFullState();
143 |
144 | public abstract boolean onBackPressed(Activity activity);
145 |
146 | @Override
147 | public void detachedEvent() {
148 | Log.i(tag, "detachedEvent ");
149 | stopVideo(false);
150 | }
151 |
152 | @Override
153 | protected void onAttachedToWindow() {
154 | super.onAttachedToWindow();
155 | isAttach = true;
156 | addEvent(this);
157 | }
158 |
159 | @Override
160 | protected void onDetachedFromWindow() {
161 | super.onDetachedFromWindow();
162 | isAttach = false;
163 | removeEvent(this);
164 | Log.i(tag, "onDetachedFromWindow ");
165 | stopVideo(false);
166 | }
167 |
168 |
169 | private RecyclerView.OnScrollListener recyclerListener = new RecyclerView.OnScrollListener() {
170 | @Override
171 | public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
172 | super.onScrollStateChanged(recyclerView, newState);
173 | }
174 |
175 | @Override
176 | public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
177 | super.onScrolled(recyclerView, dx, dy);
178 | translationY -= dy;
179 | setTranslationY((float) translationY);
180 | //scrollBy 即表示在原先偏移的基础上在发生偏移
181 | }
182 | };
183 |
184 | @Override
185 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
186 | Log.i(tag, "positionOffsetPixels=" + positionOffsetPixels);
187 | }
188 |
189 | @Override
190 | public void onPageSelected(int position) {
191 |
192 | }
193 |
194 | @Override
195 | public void onPageScrollStateChanged(int state) {
196 |
197 | }
198 |
199 | @Override
200 | public void onViewAttachedToWindow(View v) {
201 |
202 | }
203 |
204 |
205 | @Override
206 | public void onViewDetachedFromWindow(View v) {
207 | if (v.equals(currentPlayView) && !isFullState()) {
208 | v.removeOnAttachStateChangeListener(this);
209 | LogUtils.i(tag,"v.equals(currentPlayView)");
210 | stopVideo(false);
211 | }
212 | Log.i(tag, "onViewDetachedFromWindow = " + v.equals(currentPlayView));
213 | }
214 | }
215 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/anim/in_from_down.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/anim/in_from_fade.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/anim/in_from_up.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/anim/out_from_down.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/anim/out_from_fade.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/anim/out_from_up.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/drawable-xhdpi/mediacontroller_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/vlcplayer/src/main/res/drawable-xhdpi/mediacontroller_change.png
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/drawable-xhdpi/mediacontroller_small_pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/vlcplayer/src/main/res/drawable-xhdpi/mediacontroller_small_pause.png
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/drawable-xhdpi/mediacontroller_small_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/vlcplayer/src/main/res/drawable-xhdpi/mediacontroller_small_play.png
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/drawable-xhdpi/mediacontroller_speed_last.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/vlcplayer/src/main/res/drawable-xhdpi/mediacontroller_speed_last.png
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/drawable-xhdpi/mediacontroller_speed_next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/vlcplayer/src/main/res/drawable-xhdpi/mediacontroller_speed_next.png
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/drawable-xhdpi/play_control_scrubber.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/vlcplayer/src/main/res/drawable-xhdpi/play_control_scrubber.9.png
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/drawable-xhdpi/scrubber_primary_holo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/vlcplayer/src/main/res/drawable-xhdpi/scrubber_primary_holo.9.png
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/drawable-xhdpi/scrubber_secondary_holo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mengzhidaren/VlcPlayer/5c23234ba1b39e37f25447c7472d671469554e68/vlcplayer/src/main/res/drawable-xhdpi/scrubber_secondary_holo.9.png
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/drawable/mediacontroller_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/drawable/mediacontroller_speed.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/drawable/scrubber_progress_horizontal_holo_dark.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
16 | -
17 |
20 |
21 | -
22 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/layout/video_list_controller.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/layout/video_view_controller_small.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
23 |
24 |
32 |
33 |
40 |
41 |
52 |
53 |
61 |
62 |
71 |
72 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/layout/video_view_controller_widget.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
14 |
15 |
21 |
22 |
29 |
30 |
31 |
39 |
40 |
46 |
47 |
48 |
49 |
57 |
58 |
64 |
65 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #686868
5 | #afafaf
6 | #1d1d1d
7 | #ffdc10
8 |
9 | #1abc9c
10 | #16a085
11 | #2ecc71
12 | #27ae60
13 | #3498db
14 | #2980b9
15 | #21aabd
16 | #15707c
17 | #654b6b
18 | #443248
19 | #34495e
20 | #2c3e50
21 | #e67e22
22 | #d35400
23 | #e74c3c
24 | #c0392b
25 | #70000000
26 | #17e49f
27 | #CC000000
28 | #7f000000
29 | #26000000
30 | #66000000
31 | #bf000000
32 | #40000000
33 | #DA000000
34 | #4D000000
35 | #70000000
36 | #80000000
37 | #ff53c1bd
38 | #99000000
39 | #b4000000
40 | #65000000
41 | #ffd10c
42 | #17e49f
43 |
44 | #e5e5e5
45 | #17e49f
46 | #17e49f
47 |
48 | #ffd10c
49 | #17e49f
50 | #17e49f
51 |
52 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/vlcplayer/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
14 |
15 |
--------------------------------------------------------------------------------