Giter Site home page Giter Site logo

rain168 / nicevieoplayer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jianjunxiao/nicevieoplayer

0.0 3.0 1.0 6.39 MB

IjkPlayer/MediaPlayer+TextureView,完美切换全屏、小窗口的Android视频播放器

Home Page: http://www.jianshu.com/p/420f7b14d6f6

Java 100.00%

nicevieoplayer's Introduction

NiceVieoPlayer

用IjkPlayer/MediaPlayer + TextureView封装,完美切换全屏、小窗口播放。

Usage

下载niceviewoplayer库,在AndroidSutio中作为Mudule添加依赖。

1.在Activity中使用:

 private void init() {
      mNiceVideoPlayer = (NiceVideoPlayer) findViewById(R.id.nice_video_player);
      mNiceVideoPlayer.setPlayerType(NiceVideoPlayer.PLAYER_TYPE_IJK); // or NiceVideoPlayer.PLAYER_NATIVE
      mNiceVideoPlayer.setUp(mVideoUrl, null);
      NiceVideoPlayerController controller = new NiceVideoPlayerController(this);
      controller.setTitle(mTitle);
      controller.setImage(mImageUrl);
      mNiceVideoPlayer.setController(controller);
  }
  
  // 按返回键
  // 当前是全屏或小窗口,需要先退出全屏或小窗口。
  @Override
  public void onBackPressed() {
      if (NiceVideoPlayerManager.instance().onBackPressd()) {
          return;
      }
      super.onBackPressed();
  }

2.在RecyclerView列表中使用需要监听itemView detach:

mRecyclerView.addOnChildAttachStateChangeListener(new RecyclerView.OnChildAttachStateChangeListener() {
    @Override
    public void onChildViewAttachedToWindow(View view) {

    }

    @Override
    public void onChildViewDetachedFromWindow(View view) {
        NiceVideoPlayer niceVideoPlayer = (NiceVideoPlayer) view.findViewById(R.id.nice_video_player);
        if (niceVideoPlayer != null) {
            niceVideoPlayer.release();
        }
    }
});

Proguard

-keep class tv.danmaku.ijk.media.player.**{*;}

Demo

nicevieoplayer's People

Contributors

jianjunxiao avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

mingfengsly

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.