Giter Club home page Giter Club logo

android_sdk's Introduction

android_sdk

This document describes integration of a native Android app to HolaCDN.

  • Currently supports MediaPlayer, VideoView and ExoPlayer (HLS mode only)
  • Android version 4.4 and above is required.

Note: An [iOS version] (https://github.com/hola/ios_sdk) is also available.

If you have any questions, email us at [email protected], or skype: holacdn

Initialization

  • On app start init HolaCDN by calling init method.

    Signature:

    void org.hola.cdn_sdk.init(Context ctx, String customer, Bundle extra,
        Handler callback);
  • Initialization occurs asynchronically. During that process two messages may be send to callback handler (with different "what" properties):

    org.hola.cdn_sdk.api.SERVICE_CONNECTED: it's send when api is connected to CDN service.

    org.hola.cdn_sdk.api.WEBSOCKET_CONNECTED: it's send when CDN service is connected to internal CDN code.

  • function to check state:

    boolean org.hola.cdn_sdk.api.is_inited(): returns true if service is started

    boolean org.hola.cdn_sdk.api.is_connected(): returns true if service exists and is connected to the internal CDN code

    boolean org.hola.cdn_sdk.api.is_attached(): returns true if service exists and the wrapper is attached to MediaPlayer

  • init example (inside an Activity):

    org.hola.cdn_sdk.api m_hola_cdn = new org.hola.cdn_sdk.api();
    Handler m_callback = new Handler(){
        @Override
        public void handleMessage(Message msg){
            Log.d("Demo", Integer.toString(msg.what); }
    };
    Bundle extra = new Bundle();
    extra.putString("hola_mode", "origin_cdn");
    m_hola_cdn.init(this, "demo", extra, m_callback);

Attaching

Attachment is required to activate HolaCDN features. At the moment, hola_cdn mode for MediaPlayer object and HLS source is functional. Example:

MediaPlayer m_player = new MediaPlayer();
if (!m_hola_cdn.is_connected())
    Log.d("Demo", "HolaCDN isn't connected, skip attaching");
else
    m_player = m_hola_cdn.attach(m_player);

Afterwards, m_player instance can be used as a regular MediaPlayer object.

Also, HolaCDN SDK supports:

  • VideoView+Google IMA (see imademo)
  • ExoPlayer+HLS (see exoplayerdemo)

Reporting

void org.hola.cdn_sdk.api.get_stats(): outputs current HolaCDN stats to logcat

android_sdk's People

Contributors

akashta avatar arielshu avatar dottedmag avatar paulannekov avatar pavelkin avatar stan-ros avatar

Watchers

 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.