GithubHelp home page GithubHelp logo

lzp5579 / commenplayer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dsiner/commenplayer

1.0 2.0 0.0 86.27 MB

CommenPlayer for Android,支持ijkplayer、vlc、mediaplayer、exoplayer、视频播放器

Java 100.00%

commenplayer's Introduction

CommenPlayer for Android

License

CommenPlayer 是一个适用于 Android 平台的视频播放器,基于ijkplayer、Android MediaPlayer、ExoPlayer / vlc

Branch

  • master - 开发分支,基于 ijkplayer ,支持ijkplayer、Android MediaPlayer、ExoPlayer切换
  • ijk-default - 发布分支,支持格式最全,基于 ijkplayer ,支持ijkplayer、Android MediaPlayer、ExoPlayer切换
  • ijk-lite - 发布分支,lite,基于 ijkplayer ,支持ijkplayer、Android MediaPlayer、ExoPlayer切换
  • vlc - 发布分支,基于 vlc , 测试阶段

Demo

Screenshot

Features

  • 支持本地和网络视频播放
  • 支持 M3U8、RTMP、RTSP、UDP 协议的直播流媒体播放
  • 支持常见的音视频文件播放(MP4、mp3、flv等)
  • 支持播放控制,进度显示
  • 支持手势滑动调节播放进度、亮度、声音
  • 支持画面尺寸切换(16:9,4:3,自适应,撑满等)
  • 支持横竖屏切换、全屏模式、列表播放、列表播放/全屏模式切换
  • 支持全屏沉浸式模式

Usage

    <com.d.commenplayer.CommenPlayer
        android:id="@+id/player"
        android:layout_width="match_parent"
        android:layout_height="180dp" />

Operation

        player.setLive(false);
        player.setOnNetListener(new OnNetListener() {
            @Override
            public void onIgnoreMobileNet() {
                ignoreNet = true;
            }
        }).setOnPlayerListener(new IPlayerListener() {
            @Override
            public void onLoading() {
                player.getControl().setState(ControlLayout.STATE_LOADING);
            }

            @Override
            public void onCompletion(IMediaPlayer mp) {
                player.getControl().setState(ControlLayout.STATE_COMPLETION);
            }

            @Override
            public void onPrepared(IMediaPlayer mp) {
                if (!ignoreNet && NetConstans.NET_STATUS == NetConstans.CONNECTED_MOBILE) {
                    player.pause();
                    player.getControl().setState(ControlLayout.STATE_MOBILE_NET);
                } else {
                    player.getControl().setState(ControlLayout.STATE_PREPARED);
                }
            }

            @Override
            public boolean onError(IMediaPlayer mp, int what, int extra) {
                player.getControl().setState(ControlLayout.STATE_ERROR);
                return false;
            }

            @Override
            public boolean onInfo(IMediaPlayer mp, int what, int extra) {
                return false;
            }

            @Override
            public void onVideoSizeChanged(IMediaPlayer mp, int width, int height, int sarNum, int sarDen) {

            }
        });
        player.play(url);

Activity Lifecycle

    Override onResume()、onPause()、onConfigurationChanged()、onBackPressed()、onDestroy()

More usage see Demo

Thanks

Licence

Copyright 2017 D

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

commenplayer's People

Contributors

dsiner avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.