Giter Site home page Giter Site logo

videoplayer-1's Introduction

VideoPlayer

android 视频播放框架 支持小窗口 recycleview列表 缓存,全屏播放,切换清晰度等

一 引用

` allprojects {

repositories {
  ...
  maven { url 'https://jitpack.io'
  }
}

}`

在你的moudle下得build.gradle引用

dependencies { implementation 'com.github.lkxiaojian:VideoPlayer:1.1.3' }

在对应的Activity视频界面的AndroidManifest.xml中添加

android:configChanges="orientation|keyboardHidden|screenSize"

` 如:

 `  <activity
        android:name=".SmallPlayerActivity"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:screenOrientation="portrait" />``

二 使用

` 引用自定义布局

   <com.lk.playvideolibrary.NiceVideoPlayer
    android:id="@+id/nice_video_player"
    android:layout_width="match_parent"
    android:layout_height="180dp"
    android:layout_marginBottom="8dp"
    android:layout_marginTop="16dp" />`
` 逻辑

    mNiceVideoPlayer.setUp(videoUrl, null);
    TxVideoPlayerController controller = new TxVideoPlayerController(this);
    controller.setShareClickListener(this);
    controller.setVisible(View.VISIBLE);
    controller.setTitle("哈哈,我是标题");
    controller.setLenght(98000);
    Glide.with(this)
            .load("封面图片地址")
            .placeholder(R.drawable.videobag)
            .crossFade()
            .into(controller.imageView());
    mNiceVideoPlayer.setController(controller);`
   按返回键的处理
    @Override
public void onBackPressed() {
    if (NiceVideoPlayerManager.instance().onBackPressd()) return;
    super.onBackPressed();
}

@Override
protected void onStop() {
    super.onStop();
    NiceVideoPlayerManager.instance().releaseNiceVideoPlayer();
}

videoplayer-1's People

Contributors

lkxiaojian avatar

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.