首先导入依赖库
compile 'fm.jiecao:jiecaovideoplayer:5.5'
将其版本改成16minSdkVersion 16 布局文件<fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard android:id="@+id/jiecao_Player" android:layout_width="match_parent" android:layout_height="200dp"> </fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard>
主界面代码public class MainActivity extends AppCompatActivity { private JCVideoPlayerStandard jcVideoPlayerStandard; String s1="http://2449.vod.myqcloud.com/2449_22ca37a6ea9011e5acaaf51d105342e3.f20.mp4"; String s2="http://player.youku.com/player.php/sid/XMjUyODI2NDc2MA==/v.swf";//不支持swf格式的视频播放 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getSupportActionBar().setTitle("jiecaovideoplayer的使用"); jcVideoPlayerStandard= (JCVideoPlayerStandard) findViewById(R.id.jiecao_Player); jcVideoPlayerStandard.setUp(s1,JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL,"达奚阿碧"); } @Override public void onBackPressed() { if (JCVideoPlayer.backPress()){ return; } super.onBackPressed(); } @Override protected void onPause() { super.onPause(); JCVideoPlayer.releaseAllVideos(); } } 清单文件中也需要加一些东西<activity android:name=".MainActivity" android:configChanges="orientation|screenSize|keyboardHidden" android:screenOrientation="portrait" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
视频播放器--jiecaovideoplayer
最新推荐文章于 2021-08-10 16:16:13 发布