0

我正在为 Android 上的流媒体电视创建应用程序,但我想集成插件 Vitamio,以便它能够承受 Wowza 的协议。我该怎么做呢?

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

我有这个代码:

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;
    }

}

我想在下面插入代码:

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();

        }
    }
}
4

3 回答 3

0

由于违反 google play 政策,Cordova Vitamio 插件将不会在 google play 中接受。使用 Cordova Exoplayer https://github.com/frontyard/cordova-exoplayer-plugin

于 2017-04-04T12:51:32.720 回答
0

现在实际上有一个插件......我前一阵子需要这个,有一天偶然发现它。

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

顺便说一句,效果很好。

于 2016-02-01T02:52:02.280 回答