The simplest use of jiecao video player

Keywords: Android network


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.

  compile 'fm.jiecao:jiecaovideoplayer:5.5'
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 permission
    <activity android:name=".JieCaoVideoActivity"
            android:configChanges="orientation|screenSize|keyboardHidden"
            android:screenOrientation="portrait"></activity>
Then go to the layout and write the controls

<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>
At last, it is the writing method in our implementation method
public 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();
    }
}
That's it no more

Posted by DssTrainer on Sat, 02 May 2020 04:30:52 -0700