mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 19:18:06 +00:00
Add JNI wrapper for linphone_player_get_duration and linphone_player_get_current_position
This commit is contained in:
parent
c61b246f36
commit
a2f8befbcf
5 changed files with 34 additions and 2 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue