Giter Club home page Giter Club logo

fastvideoplayer's Introduction

FastVideoPlayer

基于ijkplayer开发万能播放器,支持点播、直播播放。

如何引用

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
        compile 'com.github.fanhua1994:FastVideoPlayer:1.0.6'
}

demo演示

AndroidMainist.xml

 <activity android:name=".MainActivity"
    android:configChanges="orientation|screenSize|keyboardHidden">
</activity>
<com.hengyi.fastvideoplayer.library.FastVideoPlayer
    android:id="@+id/fastvideo_player"
    android:layout_width="match_parent"
    android:layout_height="200dp"></com.hengyi.fastvideoplayer.library.FastVideoPlayer>
videoPlayer = findViewById(R.id.fastvideo_player);
videoPlayer.setLive(false);//是直播还是点播  false为点播
videoPlayer.setScaleType(FastVideoPlayer.SCALETYPE_FITXY);
videoPlayer.setTitle("TiDB宣传视频");//设置标题
videoPlayer.setUrl("https://download.pingcap.com/videos/pingcap-intro-converted.mp4");
videoPlayer.play();//自动播放
//封面图加载
Glide.with(this).load("https://download.pingcap.com/images/video-poster.jpg").into(videoPlayer.getCoverImage());

屏幕监听

videoPlayer.setScreenListener(new FastVideoPlayerScreenListener() {
    @Override
    public void onFullScreen() {
        Toast.makeText(MainActivity.this,"进入全屏",Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onSmallScreen() {
        Toast.makeText(MainActivity.this,"进入小屏",Toast.LENGTH_SHORT).show();
    }
});
/**
 * 下面的这几个Activity的生命状态很重要
 */
@Override
protected void onPause() {
    super.onPause();
    if (videoPlayer != null) {
        videoPlayer.onPause();
    }
}

@Override
protected void onResume() {
    super.onResume();
    if (videoPlayer != null) {
        videoPlayer.onResume();
    }
}

@Override
protected void onDestroy() {
    super.onDestroy();
    if (videoPlayer != null) {
        videoPlayer.onDestroy();
    }
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (videoPlayer != null) {
        videoPlayer.onConfigurationChanged(newConfig);
    }
}

@Override
public void onBackPressed() {
    if (videoPlayer != null && videoPlayer.onBackPressed()) {
        return;
    }
    super.onBackPressed();
}

fastvideoplayer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fastvideoplayer's Issues

Type

videoPlayer = (FastVideoPlayer) findViewById(R.id.fastvideo_player);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.