use of com.getcapacitor.PluginMethod in project capacitor-plugins by ionic-team.
the class TextZoomPlugin method getPreferred.
@PluginMethod
public void getPreferred(final PluginCall call) {
JSObject ret = new JSObject();
ret.put("value", textZoom.getPreferred());
call.resolve(ret);
}
use of com.getcapacitor.PluginMethod in project capacitor-video-player by jepiqueau.
the class CapacitorVideoPlayerPlugin method getDuration.
@PluginMethod
public void getDuration(final PluginCall call) {
this.call = call;
JSObject ret = new JSObject();
ret.put("method", "getDuration");
String playerId = call.getString("playerId");
if (playerId == null) {
ret.put("result", false);
ret.put("message", "Must provide a PlayerId");
call.resolve(ret);
return;
}
if ("fullscreen".equals(mode) && fsPlayerId.equals(playerId)) {
bridge.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
JSObject ret = new JSObject();
ret.put("method", "getDuration");
if (fsFragment != null) {
int duration = fsFragment.getDuration();
ret.put("result", true);
ret.put("value", duration);
call.resolve(ret);
} else {
ret.put("result", false);
ret.put("message", "Fullscreen fragment is not defined");
call.resolve(ret);
}
}
});
} else {
ret.put("result", false);
ret.put("message", "player is not defined");
call.resolve(ret);
}
}
use of com.getcapacitor.PluginMethod in project capacitor-video-player by jepiqueau.
the class CapacitorVideoPlayerPlugin method stopAllPlayers.
@PluginMethod
public void stopAllPlayers(PluginCall call) {
this.call = call;
bridge.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
JSObject ret = new JSObject();
ret.put("method", "stopAllPlayers");
if (fsFragment != null) {
fsFragment.pause();
ret.put("result", true);
ret.put("value", true);
call.resolve(ret);
} else {
ret.put("result", false);
ret.put("message", "Fullscreen fragment is not defined");
call.resolve(ret);
}
}
});
}
use of com.getcapacitor.PluginMethod in project capacitor-video-player by jepiqueau.
the class CapacitorVideoPlayerPlugin method pause.
@PluginMethod
public void pause(final PluginCall call) {
this.call = call;
JSObject ret = new JSObject();
ret.put("method", "pause");
String playerId = call.getString("playerId");
if (playerId == null) {
ret.put("result", false);
ret.put("message", "Must provide a PlayerId");
call.resolve(ret);
return;
}
if ("fullscreen".equals(mode) && fsPlayerId.equals(playerId)) {
bridge.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
JSObject ret = new JSObject();
ret.put("method", "pause");
if (fsFragment != null) {
fsFragment.pause();
ret.put("result", true);
ret.put("value", true);
call.resolve(ret);
} else {
ret.put("result", false);
ret.put("message", "Fullscreen fragment is not defined");
call.resolve(ret);
}
}
});
} else {
ret.put("result", false);
ret.put("message", "player is not defined");
call.resolve(ret);
}
}
use of com.getcapacitor.PluginMethod in project capacitor-video-player by jepiqueau.
the class CapacitorVideoPlayerPlugin method setMuted.
@PluginMethod
public void setMuted(final PluginCall call) {
this.call = call;
JSObject ret = new JSObject();
ret.put("method", "setMuted");
String playerId = call.getString("playerId");
if (playerId == null) {
ret.put("result", false);
ret.put("message", "Must provide a PlayerId");
call.resolve(ret);
return;
}
Boolean value = call.getBoolean("muted");
if (value == null) {
ret.put("result", true);
ret.put("message", "Must provide a boolean true/false");
call.resolve(ret);
return;
}
final boolean bValue = value;
if ("fullscreen".equals(mode) && fsPlayerId.equals(playerId)) {
bridge.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
JSObject ret = new JSObject();
ret.put("method", "setMuted");
if (fsFragment != null) {
fsFragment.setMuted(bValue);
ret.put("result", true);
ret.put("value", bValue);
call.resolve(ret);
} else {
ret.put("result", false);
ret.put("message", "Fullscreen fragment is not defined");
call.resolve(ret);
}
}
});
} else {
ret.put("result", false);
ret.put("message", "player is not defined");
call.resolve(ret);
}
}
Aggregations