![](https://csdnimg.cn/release/phoenix/images/category_icon.jpg)
用法概括(28)
实现效果(87)
![](https://csdnimg.cn/release/phoenix/images/arrow_triangle%20_down.jpg)
![](https://csdnimg.cn/release/phoenix/images/arrow_triangle%20_down.jpg)
效果图:
导入依赖
- compile 'com.dou361.ijkplayer:jjdxm-ijkplayer:1.0.5'
布局中
- <include
- layout="@layout/simple_player_view_player"
- android:layout_width="match_parent"
- android:layout_height="300dp"/>
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
代码中
- public class ThirdActivity extends AppCompatActivity {
- PlayerView play;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_third);
- // String url = Environment.getExternalStorageDirectory()
- // .getAbsolutePath() + "/local/adc.mp4";
- String url ="http://ips.ifeng.com/video19.ifeng.com/video09/2014/06/16/1989823-102-086-0009.mp4";
- play = new PlayerView(this)
- .setTitle("什么")
- .setScaleType(PlayStateParams.fitparent)
- .hideMenu(true)
- .forbidTouch(false)
- .setPlaySource(url);
- play.startPlay();
- }
- @Override
- protected void onStop() {
- super.onStop();
- play.stopPlay();
- }
- }