GithubHelp home page GithubHelp logo

streamplayervitamio5's Introduction

StreamPlayerVitamio5

Audio Stream with Vitamio 5.0.0

Vitamio 5.0.0 : http://wscdn.miaopai.com/download/VitamioBundle20151118.zip

This is the Audio Streaming project that works with Vitamio 5.0.0.

In version 5.0.0, some classes/methods no longer available.

# version 4.x
if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this))
  return;

# version 5.0.0
Vitamio.isInitialized(this);

In version 5.0.0, OnPrepareListener will not fire, if you do not implement @Overwrite onInfo
Below example will works

public class MainActivity extends AppCompatActivity {
    private MediaPlayer mPlayer = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        Vitamio.isInitialized(this);
        streamAudio("http://209.105.250.73:8650/autodj");
    }
    
    private void streamAudio(String streamURL) {
        mPlayer = new MediaPlayer(this);
        try {
            mPlayer.setDataSource(streamURL);
            mPlayer.prepareAsync();

            mPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mp) {
                    Log.d("XXX", ">>>>>>>>>>>>>>>>>>>>>>>> onPrepared: mp.start();");
                    mp.start();
                }
            });

            mPlayer.setOnInfoListener(new MediaPlayer.OnInfoListener() {
                @Override
                public boolean onInfo(MediaPlayer mp, int what, int extra) {
                    switch (what) {
                        case MediaPlayer.MEDIA_INFO_FILE_OPEN_OK: // line added 1
                            Log.d("XXX", ">>>>>>>>>>>>>>>>>>>>>>>> onInfo: MEDIA_INFO_FILE_OPEN_OK");
                            long buffersize = mPlayer.audioTrackInit(); // line added 2
                            mPlayer.audioInitedOk(buffersize); // line added 3
                            break;
                    }
                    return true;
                }
            });

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

streamplayervitamio5's People

Contributors

ahpiau18 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.