Skip to content

Commit a275ea0

Browse files
committed
2.1.0
1 parent 231a2a6 commit a275ea0

36 files changed

+325
-211
lines changed

README.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# **iPlayer**
22

33
#### 一、SDK基础功能
4-
* 支持网络地址、直播流、本地Assets和Raw资源文件播放</br>
4+
* 支持网络地址、直播流、本地Assets和Raw音视频资源文件播放</br>
55
* 支持播放倍速、缩放模式、静音、镜像等功能设置</br>
66
* 支持自定义视频解码器、控制器、UI交互组件、视频画面渲染器</br>
77
* 支持多播放器同时播放</br>
88
* SDK默认控制器(局部UI交互可自定义)支持手势控制、付费试看等交互</br>
9+
* 支持重力感应横竖屏旋转及开关设置</br>
910
* 支持任意位置启动Activity级别悬浮窗口播放</br>
1011
* 支持任意位置启动全局悬浮窗口播放</br>
1112
* 支持任意位置直接启动全屏播放</br>
@@ -111,20 +112,20 @@
111112
[5]:https://github.com/hty527/iPlayer/wiki/api "点击"
112113
#### 五、SDK及Demo部分功能预览
113114
<div align="center">
114-
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/screenshot1.jpg?q=1" width="270",height="585">
115-
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/screenshot2.jpg?q=2" width="270",height="585">
115+
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/src1.jpg?q=1" width="270",height="585">
116+
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/src2.jpg?q=2" width="270",height="585">
116117
</div>
117118
<div align="center">
118-
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/screenshot3.jpg?q=3" width="270",height="585">
119-
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/screenshot4.jpg?q=4" width="270",height="585">
119+
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/src3.jpg?q=3" width="270",height="585">
120+
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/src4.jpg?q=4" width="270",height="585">
120121
</div>
121122
<div align="center">
122-
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/screenshot5.jpg?q=5" width="270",height="585">
123-
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/screenshot6.jpg?q=6" width="270",height="585">
123+
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/src5.jpg?q=5" width="270",height="585">
124+
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/src6.jpg?q=6" width="270",height="585">
124125
</div>
125126
<div align="center">
126-
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/screenshot7.jpg?q=7" width="270",height="585">
127-
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/screenshot8.jpg?q=8" width="270",height="585">
127+
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/src7.jpg?q=7" width="270",height="585">
128+
<img src="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/image/src8.jpg?q=8" width="270",height="585">
128129
</div>
129130

130131
#### 六、鸣谢

app/build.gradle

+11-9
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,24 @@ dependencies {
7777
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
7878
implementation 'com.google.code.gson:gson:2.8.5'
7979
//播放器SDK
80-
implementation project(':iplayer')
80+
// implementation project(':iplayer')
8181
//UI交互组件
82-
implementation project(':widget')
82+
// implementation project(':widget')
8383
//ijk音视频解码器
84-
implementation project(':ijk')
84+
// implementation project(':ijk')
8585
//exo音视频解码器
86-
implementation project(':exo')
86+
// implementation project(':exo')
8787
//音视频缓存
88-
implementation project(':cache')
88+
// implementation project(':cache')
8989

9090
//播放器SDK
91-
// implementation 'com.github.hty527.iPlayer:iplayer:2.1.0'
91+
implementation 'com.github.hty527.iPlayer:iplayer:2.1.0'
92+
//UI交互组件,可根据需要使用
93+
implementation 'com.github.hty527.iPlayer:widget:2.1.0'
9294
//音视频预缓存+边播边存,根据需要使用
93-
// implementation 'com.github.hty527.iPlayer:cache:2.1.0'
95+
implementation 'com.github.hty527.iPlayer:cache:2.1.0'
9496
//ijk音视频解码器,根据自己需要实现
95-
// implementation 'com.github.hty527.iPlayer:ijk:2.1.0'
97+
implementation 'com.github.hty527.iPlayer:ijk:2.1.0'
9698
//exo音视频解码器,根据自己需要实现
97-
// implementation 'com.github.hty527.iPlayer:exo:2.1.0'
99+
implementation 'com.github.hty527.iPlayer:exo:2.1.0'
98100
}

app/src/main/java/com/android/videoplayer/base/BaseActivity.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ public abstract class BaseActivity <P extends BasePresenter> extends AppCompatAc
3636
public static final String MP4_URL3 ="http://cdnxdc.tanzi88.com/XDC/dvideo/2017/11/29/15f22f48466180232ca50ec25b0711a7.mp4";//网络视频-七舅脑爷
3737
public static final String MP4_URL4 ="https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_30mb.mp4";//国外CDN-熊,慢
3838
public static final String FLV_URL1 ="https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv";//FLV格式测试流
39+
public static final String MP3 ="http://mpge.5nd.com/2022/2022-8-22/3277829/1.mp3";//FLV格式测试流
40+
public static final String WMV ="https://amuse-1259486925.cos.ap-hongkong.myqcloud.com/video/ts_1080.ts";//FLV格式测试流
3941

4042
/**
4143
* 直播测试流
4244
*/
4345
public static final String LIVE_M3U8_APPLE ="http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear2/prog_index.m3u8";//苹果计时器
4446
public static final String LIVE_M3U8_TIME ="http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8";//计时器
4547

46-
public static final String LIVE_M3U8_WS ="http://219.151.31.38/liveplay-kk.rtxapp.com/live/program/live/hnwshd/4000000/mnf.m3u8";//央视、cctv8、各大卫视,每次重启APP后随机 (MediaPlayer(支持)、IJKMediaPlayer(支持)、ExoPlayer(支持))
4748
public static final String LIVE_RTSP ="rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4";//动画视频 (MediaPlayer(支持)、IJKMediaPlayer(支持)、ExoPlayer(支持))
4849
public static final String LIVE_RTMP1 ="rtmp://ns8.indexforce.com/home/mystream";//伊拉克 Al Sharqiya 电视台 (MediaPlayer(不支持)、IJKMediaPlayer(支持)、ExoPlayer(支持))
4950
public static final String LIVE_RTMP2 ="rtmp://mobliestream.c3tv.com:554/live/goodtv.sdp";//韩国GOOD TV (MediaPlayer(不支持)、IJKMediaPlayer(支持)、ExoPlayer(支持))

app/src/main/java/com/android/videoplayer/ui/activity/LivePlayerActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
public class LivePlayerActivity extends BaseActivity {
2626

27-
private int MEDIA_CORE=1;//这里用IJkMediaPlayer作为初始解码器
27+
private int MEDIA_CORE=2;//这里用IJkMediaPlayer作为初始解码器
2828

2929
@Override
3030
protected void onCreate(@Nullable Bundle savedInstanceState) {

app/src/main/java/com/android/videoplayer/ui/activity/MainActivity.java

-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
import android.view.KeyEvent;
99
import android.view.View;
1010
import android.widget.Toast;
11-
1211
import androidx.recyclerview.widget.LinearLayoutManager;
1312
import androidx.recyclerview.widget.RecyclerView;
14-
1513
import com.android.iplayer.base.AbstractMediaPlayer;
1614
import com.android.iplayer.controller.VideoController;
1715
import com.android.iplayer.listener.OnPlayerEventListener;

app/src/main/java/com/android/videoplayer/ui/activity/VideoPlayerActivity.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public void onMute(boolean isMute) {
168168
mVideoPlayer.setProgressCallBackSpaceMilliss(300);//设置进度条回调间隔时间(毫秒)
169169
mVideoPlayer.setSpeed(1.0f);//设置播放倍速(默认正常即1.0f,区间:0.5f-2.0f)
170170
mVideoPlayer.setMirror(false);//是否镜像显示
171-
mVideoPlayer.setAutoChangeOrientation(true);//是否开启重力旋转。仅竖屏/横屏之间切换,仅正在播放中生效
171+
mVideoPlayer.setAutoChangeOrientation(true);//是否开启重力旋转。当系统"自动旋转"开启+正在播放生效
172172
//mVideoPlayer.setPlayCompletionRestoreDirection(true);//播放器在横屏状态下播放完成是否自动还原到竖屏状态,默认自动还原到竖屏
173173
//mVideoPlayer.setMobileNetwork(true);//移动网络下是否允许播放网络视频,需要声明权限:<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
174174
//mVideoPlayer.setInterceptTAudioFocus(true);//是否监听音频焦点状态,设置为true后SDK在监听焦点丢失时自动暂停播放
@@ -210,6 +210,11 @@ public void setCanTouchInPortrait(boolean canTouchInPortrait) {
210210
if (null != mController) mController.setCanTouchInPortrait(canTouchInPortrait);
211211
}
212212

213+
@Override
214+
public void onChangeOrientation(boolean changeOrientation) {
215+
if(null!=mVideoPlayer) mVideoPlayer.setAutoChangeOrientation(changeOrientation);
216+
}
217+
213218
@Override
214219
public void rePlay(String url) {
215220
if(!TextUtils.isEmpty(url)){

app/src/main/java/com/android/videoplayer/utils/DataFactory.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ public List<Menu> getMenus() {
7979
menus.add(new Menu(getString(R.string.text_item_home,"项目主页"),18,getString(R.string.text_item_sub_other,"其它"),3));
8080
Menu menu = new Menu("", 101, getString(R.string.text_item_version,"版本预告"), 3, 1);
8181
Version version=new Version();
82-
version.setCode("2.0.xx");
82+
version.setCode("2.1.xx");
8383
version.setTime(getString(R.string.text_item_time,"待定,请持续关注"));
84-
version.setDescript(getString(R.string.text_item_desc,"1、新增重力旋转功能,支持重力旋转开关及阻尼设置"));
84+
version.setDescript(getString(R.string.text_item_desc,"1、播放器新增支持上一集、下一集、选集播放、清晰度功能"));
8585
menu.setVersion(version);
8686
menus.add(menu);
8787
return menus;

app/src/main/java/com/android/videoplayer/video/ui/fragment/ListPlayerFragment.java

+1
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ protected void startPlayer(ViewGroup playerContainer,int position) {
282282
String[] videoPath = PlayerManager.getInstance().getVideoPath(itemData);
283283
mVideoPlayer.getController().setTitle(videoPath[1]);//视频标题(默认视图控制器横屏可见)
284284
mVideoPlayer.setDataSource(videoPath[0]);//播放地址设置
285+
mVideoPlayer.setAutoChangeOrientation(true);
285286
mVideoPlayer.prepareAsync();//开始异步准备播放
286287
}
287288
}

app/src/main/java/com/android/videoplayer/video/ui/widget/SdkDefaultFuncation.java

+22-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public void onClick(View view) {
137137
}
138138
}
139139
});
140-
140+
//手势交互
141141
View touch_1 = findViewById(R.id.touch_1);
142142
touch_1.setSelected(true);
143143
touch_1.setOnClickListener(new View.OnClickListener() {
@@ -156,7 +156,26 @@ public void onClick(View view) {
156156
if(null!=mOnActionListener) mOnActionListener.setCanTouchInPortrait(false);
157157
}
158158
});
159-
159+
//重力旋转
160+
View orientation_1 = findViewById(R.id.orientation_1);
161+
orientation_1.setSelected(true);
162+
orientation_1.setOnClickListener(new View.OnClickListener() {
163+
@Override
164+
public void onClick(View view) {
165+
findViewById(R.id.orientation_1).setSelected(true);
166+
findViewById(R.id.orientation_2).setSelected(false);
167+
if(null!=mOnActionListener) mOnActionListener.onChangeOrientation(true);
168+
}
169+
});
170+
findViewById(R.id.orientation_2).setOnClickListener(new View.OnClickListener() {
171+
@Override
172+
public void onClick(View view) {
173+
findViewById(R.id.orientation_1).setSelected(false);
174+
findViewById(R.id.orientation_2).setSelected(true);
175+
if(null!=mOnActionListener) mOnActionListener.onChangeOrientation(false);
176+
}
177+
});
178+
//测试地址播放
160179
findViewById(R.id.play).setOnClickListener(new View.OnClickListener() {
161180
@Override
162181
public void onClick(View view) {
@@ -185,6 +204,7 @@ public interface OnActionListener{
185204
void setSoundMute(boolean mute);
186205
void setMirror(boolean mirror);
187206
void setCanTouchInPortrait(boolean canTouchInPortrait);
207+
void onChangeOrientation(boolean changeOrientation);
188208
void rePlay(String url);
189209
void onMediaCore(int mediaCore);
190210
void onRenderCore(int renderCore);

app/src/main/res/layout/view_sdk_funcation.xml

+65-29
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,56 @@
66
<TextView
77
android:layout_width="match_parent"
88
android:layout_height="wrap_content"
9+
android:layout_marginLeft="12dp"
910
android:layout_marginTop="12dp"
11+
android:text="视频解码器"
12+
android:textColor="@color/menu_sub_title_color"
13+
android:textStyle="bold"
14+
android:textSize="15dp"/>
15+
<LinearLayout
16+
android:layout_width="wrap_content"
17+
android:layout_height="33dp"
18+
android:orientation="horizontal"
19+
android:layout_marginTop="10dp"
1020
android:layout_marginLeft="12dp"
11-
android:text="播放地址"
21+
android:layout_marginRight="12dp">
22+
<TextView
23+
android:id="@+id/btn_core_1"
24+
android:layout_width="90dp"
25+
android:layout_height="match_parent"
26+
android:background="@drawable/bg_menu_left"
27+
android:textColor="@color/menu_text_selector"
28+
android:textSize="13dp"
29+
android:text="MediaPlayer"
30+
android:gravity="center"/>
31+
<TextView
32+
android:id="@+id/btn_core_2"
33+
android:layout_width="90dp"
34+
android:layout_height="match_parent"
35+
android:background="@drawable/bg_menu_center"
36+
android:textColor="@color/menu_text_selector"
37+
android:textSize="13dp"
38+
android:layout_marginLeft="-1dp"
39+
android:text="IjkPlayer"
40+
android:gravity="center"/>
41+
<TextView
42+
android:id="@+id/btn_core_3"
43+
android:layout_width="90dp"
44+
android:layout_height="match_parent"
45+
android:background="@drawable/bg_menu_right"
46+
android:textColor="@color/menu_text_selector"
47+
android:textSize="13dp"
48+
android:layout_marginLeft="-1dp"
49+
android:text="ExoPlayer"
50+
android:gravity="center"
51+
android:visibility="visible"/>
52+
</LinearLayout>
53+
<TextView
54+
android:layout_width="match_parent"
55+
android:layout_height="wrap_content"
56+
android:layout_marginTop="12dp"
57+
android:layout_marginLeft="12dp"
58+
android:text="测试播放地址"
1259
android:textColor="@color/menu_sub_title_color"
1360
android:textStyle="bold"
1461
android:textSize="15dp"/>
@@ -24,7 +71,7 @@
2471
android:layout_width="0dp"
2572
android:layout_height="match_parent"
2673
android:layout_weight="1"
27-
android:hint="请粘贴或输入视频地址"
74+
android:hint="请粘贴或输入音视频地址"
2875
android:textColorHint="#666666"
2976
android:textColor="#333333"
3077
android:textSize="14dp"
@@ -49,7 +96,7 @@
4996
android:layout_height="wrap_content"
5097
android:layout_marginLeft="12dp"
5198
android:layout_marginTop="12dp"
52-
android:text="视频解码器"
99+
android:text="画面渲染器"
53100
android:textColor="@color/menu_sub_title_color"
54101
android:textStyle="bold"
55102
android:textSize="15dp"/>
@@ -61,33 +108,23 @@
61108
android:layout_marginLeft="12dp"
62109
android:layout_marginRight="12dp">
63110
<TextView
64-
android:id="@+id/btn_core_1"
111+
android:id="@+id/btn_render_1"
65112
android:layout_width="90dp"
66113
android:layout_height="match_parent"
67114
android:background="@drawable/bg_menu_left"
68115
android:textColor="@color/menu_text_selector"
69116
android:textSize="13dp"
70-
android:text="MediaPlayer"
71-
android:gravity="center"/>
72-
<TextView
73-
android:id="@+id/btn_core_2"
74-
android:layout_width="90dp"
75-
android:layout_height="match_parent"
76-
android:background="@drawable/bg_menu_center"
77-
android:textColor="@color/menu_text_selector"
78-
android:textSize="13dp"
79-
android:layout_marginLeft="-1dp"
80-
android:text="IjkPlayer"
117+
android:text="TextureView"
81118
android:gravity="center"/>
82119
<TextView
83-
android:id="@+id/btn_core_3"
120+
android:id="@+id/btn_render_2"
84121
android:layout_width="90dp"
85122
android:layout_height="match_parent"
86123
android:background="@drawable/bg_menu_right"
87124
android:textColor="@color/menu_text_selector"
88125
android:textSize="13dp"
89126
android:layout_marginLeft="-1dp"
90-
android:text="ExoPlayer"
127+
android:text="SurfaceView"
91128
android:gravity="center"
92129
android:visibility="visible"/>
93130
</LinearLayout>
@@ -96,7 +133,7 @@
96133
android:layout_height="wrap_content"
97134
android:layout_marginLeft="12dp"
98135
android:layout_marginTop="12dp"
99-
android:text="画面渲染器"
136+
android:text="竖屏手势交互"
100137
android:textColor="@color/menu_sub_title_color"
101138
android:textStyle="bold"
102139
android:textSize="15dp"/>
@@ -108,32 +145,31 @@
108145
android:layout_marginLeft="12dp"
109146
android:layout_marginRight="12dp">
110147
<TextView
111-
android:id="@+id/btn_render_1"
112-
android:layout_width="90dp"
148+
android:id="@+id/touch_1"
149+
android:layout_width="66dp"
113150
android:layout_height="match_parent"
114151
android:background="@drawable/bg_menu_left"
115152
android:textColor="@color/menu_text_selector"
116153
android:textSize="13dp"
117-
android:text="TextureView"
154+
android:text="开启"
118155
android:gravity="center"/>
119156
<TextView
120-
android:id="@+id/btn_render_2"
121-
android:layout_width="90dp"
157+
android:id="@+id/touch_2"
158+
android:layout_width="66dp"
122159
android:layout_height="match_parent"
123160
android:background="@drawable/bg_menu_right"
124161
android:textColor="@color/menu_text_selector"
125162
android:textSize="13dp"
126163
android:layout_marginLeft="-1dp"
127-
android:text="SurfaceView"
128-
android:gravity="center"
129-
android:visibility="visible"/>
164+
android:text="关闭"
165+
android:gravity="center"/>
130166
</LinearLayout>
131167
<TextView
132168
android:layout_width="match_parent"
133169
android:layout_height="wrap_content"
134170
android:layout_marginLeft="12dp"
135171
android:layout_marginTop="12dp"
136-
android:text="竖屏手势交互"
172+
android:text="重力旋转"
137173
android:textColor="@color/menu_sub_title_color"
138174
android:textStyle="bold"
139175
android:textSize="15dp"/>
@@ -145,7 +181,7 @@
145181
android:layout_marginLeft="12dp"
146182
android:layout_marginRight="12dp">
147183
<TextView
148-
android:id="@+id/touch_1"
184+
android:id="@+id/orientation_1"
149185
android:layout_width="66dp"
150186
android:layout_height="match_parent"
151187
android:background="@drawable/bg_menu_left"
@@ -154,7 +190,7 @@
154190
android:text="开启"
155191
android:gravity="center"/>
156192
<TextView
157-
android:id="@+id/touch_2"
193+
android:id="@+id/orientation_2"
158194
android:layout_width="66dp"
159195
android:layout_height="match_parent"
160196
android:background="@drawable/bg_menu_right"

app/src/main/res/values-zh-rCN/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<string name="text_item_home">项目主页</string>
3737
<string name="text_item_version">版本预告</string>
3838
<string name="text_item_time">待定,请持续关注</string>
39-
<string name="text_item_desc">1、新增重力旋转功能,支持重力旋转开关及阻尼设置</string>
39+
<string name="text_item_desc">1、播放器新增支持上一集、下一集、选集播放、清晰度功能</string>
4040
<string name="text_item_sub_noimal">基础</string>
4141
<string name="text_item_sub_list">列表</string>
4242
<string name="text_item_sub_window">窗口</string>

0 commit comments

Comments
 (0)