Commit a2f8befb authored by François Grisez's avatar François Grisez

Add JNI wrapper for linphone_player_get_duration and linphone_player_get_current_position

parent c61b246f
......@@ -593,7 +593,7 @@ int linphone_player_pause(LinphonePlayer *obj);
int linphone_player_seek(LinphonePlayer *obj, int time_ms);
MSPlayerState linphone_player_get_state(LinphonePlayer *obj);
int linphone_player_get_duration(LinphonePlayer *obj);
int linphone_player_get_position(LinphonePlayer *obj);
int linphone_player_get_current_position(LinphonePlayer *obj);
void linphone_player_close(LinphonePlayer *obj);
/**
......
......@@ -5275,6 +5275,14 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_LinphonePlayer_getState(JNIEnv *en
return (jint)linphone_player_get_state((LinphonePlayer *)ptr);
}
JNIEXPORT jint JNICALL Java_org_linphone_core_LinphonePlayer_getDuration(JNIEnv *env, jobject jobj, jlong ptr) {
return (jint)linphone_player_get_duration((LinphonePlayer *)ptr);
}
JNIEXPORT jint JNICALL Java_org_linphone_core_LinphonePlayer_getCurrentPosition(JNIEnv *env, jobject jobj, jlong ptr) {
return (jint)linphone_player_get_current_position((LinphonePlayer *)ptr);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphonePlayer_close(JNIEnv *env, jobject playerPtr, jlong ptr) {
LinphonePlayer *player = (LinphonePlayer *)ptr;
if(player->user_data) {
......
......@@ -85,7 +85,7 @@ int linphone_player_get_duration(LinphonePlayer *obj) {
* @param obj the player
* @return Position of the playback in milliseconds
*/
int linphone_player_get_position(LinphonePlayer *obj) {
int linphone_player_get_current_position(LinphonePlayer *obj) {
return obj->get_position(obj);
}
......
......@@ -76,6 +76,18 @@ public interface LinphonePlayer {
*/
public State getState();
/**
* Get the duration of the media
* @return The duration in milliseconds
*/
public int getDuration();
/**
* Get the position of the playback
* @return The position in milliseconds
*/
public int getCurrentPosition();
/**
* Close a file
*/
......
......@@ -44,6 +44,18 @@ public class LinphonePlayerImpl implements LinphonePlayer {
return LinphonePlayer.State.fromValue(getState(nativePtr));
}
private native int getDuration(long nativePtr);
@Override
public synchronized int getDuration() {
return getDuration(nativePtr);
}
private native int getCurrentPosition(long nativePtr);
@Override
public synchronized int getCurrentPosition() {
return getCurrentPosition(nativePtr);
}
private native void close(long nativePtr);
@Override
public synchronized void close() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment