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

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

adomuret lethea

android_sdk's Issues

Exoplayer Demo HLS

When using exoplayer demo with adapatative live hls stream, player stops working if there is a litte network problem (1 second for example) or there is a little problem with the stream for audio or video and the state goes to idle

This doesn't happen when using the original exoplayer 2 demo from google. Player catches the error and restart the stream in a faster way, so the stream continues playing-

Some idea to solve the exoplayer hola cdn demo problem?

PD: Same thing with holacdn demo

Ex
E/MediaPlayer: error (1, -1007)
E/MediaPlayer: Error (1,-1007)
D/HolaCDN: State changed: PLAYING to IDLE
I/HolaCDN/JS: LOG:loader.js:74 2017-12-20 21:21:43.157019 [1] cdn/wrapper: closing video context for http://xxxxxxx/Live/Channel(HBO_PLUS_HD)/index.m3u8
E/MediaPlayer: error (1, -1007)
E/MediaPlayer: Error (1,-1007)
D/HolaCDN: State changed: IDLE to IDLE

ExoPlayer Support

Hello,
I am using the exoplayer in my project and would like to use Hola CDN. Is there any support for this ?
Thanks!

HolaCDN demo android 6

Hola cdn demo not works when using android sdk 23+ with android 6+
Throws window add error due to android 6 new permission schema

Ex
android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@2bef0a78

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.