MCPcopy Index your code
hub / github.com/LabyStudio/java-spotify-api / getPlaybackPosition

Function getPlaybackPosition

rust/src/lib.rs:33–51  ·  view source on GitHub ↗
(_env: JNIEnv, _class: JClass)

Source from the content-addressed store, hash-verified

31
32#[no_mangle]
33pub extern "system" fn getPlaybackPosition(_env: JNIEnv, _class: JClass) -> jlong {
34 let result = std::panic::catch_unwind(|| {
35 block_on(async {
36 match get_spotify_session() {
37 Ok(Some(session)) => {
38 let timeline = session.GetTimelineProperties()?;
39 let position = timeline.Position()?;
40 Ok((position.Duration / 10_000) as jlong)
41 }
42 _ => Err(Error::new(E_FAIL, "Spotify session not available")),
43 }
44 })
45 });
46
47 match result {
48 Ok(Ok(position)) => position,
49 _ => -1,
50 }
51}
52
53#[no_mangle]
54pub extern "system" fn getTrackDuration(_env: JNIEnv, _class: JClass) -> jlong {

Callers

nothing calls this directly

Calls 1

get_spotify_sessionFunction · 0.85

Tested by

no test coverage detected