First of all, we will lead to a dependency. If you report an error when you import a dependency, it means that your version is low, and you need to change it to more than 15.
Write the following in our manifest file, but it will report red, but it will not affect our operation. Do not forget to add network permissioncompile 'fm.jiecao:jiecaovideoplayer:5.5'
Then go to the layout and write the controls<activity android:name=".JieCaoVideoActivity" android:configChanges="orientation|screenSize|keyboardHidden" android:screenOrientation="portrait"></activity>
At last, it is the writing method in our implementation method<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.bwie.xinjiaqi.MainActivity"> <fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard android:id="@+id/js" android:layout_width="match_parent" android:layout_height="300dp"> </fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard> </LinearLayout>
That's it no morepublic class MainActivity extends AppCompatActivity { private JCVideoPlayerStandard jcVideoPlayerStandard; String s1="http://ips.ifeng.com/video19.ifeng.com/video09/2014/06/16/1989823-102-086-0009.mp4"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getSupportActionBar().setTitle("jiecaovideoplayer Use of"); jcVideoPlayerStandard= findViewById(R.id.js); jcVideoPlayerStandard.setUp(s1,jcVideoPlayerStandard.SCREEN_LAYOUT_NORMAL,"Video title"); } @Override public void onBackPressed() { if (JCVideoPlayer.backPress()){ return; } super.onBackPressed(); } @Override protected void onPause() { super.onPause(); JCVideoPlayer.releaseAllVideos(); } }