我正在为Android上的流媒体电视创建一个应用程序,但我想整合插件Vitamio,以便它能够承受Wowza的协议。我该怎么做呢?
我有这段代码:
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();
}
}
}
答案 0 :(得分:0)
请查看以下链接。我希望它有所帮助 http://guides.appgyver.com/steroids/guides/phonegap_on_steroids/developing-custom-plugins/ http://cordova.apache.org/docs/en/2.5.0/guide_plugin-development_index.md.html
答案 1 :(得分:0)
现在实际上有一个插件......我前一段时间需要它,有一天偶然发现它。
Cordova Vitamio插件| https://github.com/nchutchind/Vitamio-Cordova-Plugin
非常适合顺便说一句。
答案 2 :(得分:0)
由于违反谷歌播放政策,Cordova Vitamio插件不会在Google Play中接受..使用Cordova Exoplayer https://github.com/frontyard/cordova-exoplayer-plugin