0

I'm creating an app for streaming TV on Android, but I want to integrate Plugin Vitamio so it can withstand the protocols of Wowza. How do I do this?

http://www.vitamio.org/en/

I have this code:

package com.tricedesigns;

import org.apache.cordova.api.Plugin;
import org.apache.cordova.api.PluginResult;
import org.json.JSONArray;

import android.util.Log;

public class HelloPlugin extends Plugin {

    public static final String NATIVE_ACTION_STRING="nativeAction";
    public static final String SUCCESS_PARAMETER="success";

    @Override
    public PluginResult execute(String action, JSONArray data, String callbackId) {

         Log.d("HelloPlugin", "Hello, this is a native function called from PhoneGap/Cordova!");

         //only perform the action if it is the one that should be invoked
         if (NATIVE_ACTION_STRING.equals(action)) {

             String resultType = null;
             try {
                 resultType = data.getString(0);
             }
             catch (Exception ex) {
                 Log.d("HelloPlugin", ex.toString());
             }

             if (resultType.equals(SUCCESS_PARAMETER)) {
                 //I want to insert the Vitamio code here if possible
             }
             else {
                 return new PluginResult(PluginResult.Status.ERROR, "Oops, Error :(");
             }
         }

         return null;
    }

}

and I want to insert the code below:

public class VideoViewDemo extends Activity {

    private String path = "udp://236.1.0.1:2000";
    private VideoView mVideoView;

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        if (!LibsChecker.checkVitamioLibs(this))
            return;
        setContentView(R.layout.videoview);
        mVideoView = (VideoView) findViewById(R.id.surface_view);

        if (path == "") {
            // Tell the user to provide a media file URL/path.
            Toast.makeText(VideoViewDemo.this, "Please edit VideoViewDemo Activity, and set path" + " variable to your media file URL/path", Toast.LENGTH_LONG).show();
            return;
        } else {
            mVideoView.setVideoURI(Uri.parse(path));
            mVideoView.setMediaController(new MediaController(this));
            mVideoView.requestFocus();

        }
    }
}
anderson
  • 111
  • 1
  • 5
  • Google 'create cordova plugin tutorial'. You will need to build a cordova plugin to make use of the SDK referenced above. – Dawson Loudon Mar 06 '14 at 20:51

3 Answers3

0

There actually is a plugin for this now ...I needed this a while ago and just stumbled upon it one day.

Cordova Vitamio plugin | https://github.com/nchutchind/Vitamio-Cordova-Plugin

Works great for a btw.

greaterKing
  • 317
  • 1
  • 4
  • 12
0

Cordova Vitamio plugin will not accept in google play because of violation of google play policy..Use Cordova Exoplayer https://github.com/frontyard/cordova-exoplayer-plugin

Hyderali S
  • 36
  • 4