2 * Copyright (C) 2017 Christian Browet
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include <androidjni/Intent.h>
12 #include <androidjni/JNIBase.h>
13 #include <androidjni/MediaMetadata.h>
14 #include <androidjni/PlaybackState.h>
19 class CJNIXBMCMediaSession
: public CJNIBase
, public CJNIInterfaceImplem
<CJNIXBMCMediaSession
>
22 CJNIXBMCMediaSession();
23 CJNIXBMCMediaSession(const CJNIXBMCMediaSession
& other
);
24 CJNIXBMCMediaSession(const jni::jhobject
&object
) : CJNIBase(object
) {}
25 ~CJNIXBMCMediaSession() override
;
27 static void RegisterNatives(JNIEnv
* env
);
29 void activate(bool state
);
30 void updatePlaybackState(const CJNIPlaybackState
& state
);
31 void updateMetadata(const CJNIMediaMetadata
& myData
);
32 void updateIntent(const CJNIIntent
& intent
);
34 void OnPlayRequested();
35 void OnPauseRequested();
36 void OnNextRequested();
37 void OnPreviousRequested();
38 void OnForwardRequested();
39 void OnRewindRequested();
40 void OnStopRequested();
41 void OnSeekRequested(int64_t pos
);
42 bool OnMediaButtonEvent(const CJNIIntent
& intent
);
43 bool isActive() const;
46 static void _onPlayRequested(JNIEnv
* env
, jobject thiz
);
47 static void _onPauseRequested(JNIEnv
* env
, jobject thiz
);
48 static void _onNextRequested(JNIEnv
* env
, jobject thiz
);
49 static void _onPreviousRequested(JNIEnv
* env
, jobject thiz
);
50 static void _onForwardRequested(JNIEnv
* env
, jobject thiz
);
51 static void _onRewindRequested(JNIEnv
* env
, jobject thiz
);
52 static void _onStopRequested(JNIEnv
* env
, jobject thiz
);
53 static void _onSeekRequested(JNIEnv
* env
, jobject thiz
, jlong pos
);
54 static bool _onMediaButtonEvent(JNIEnv
* env
, jobject thiz
, jobject intent
);
56 bool m_isActive
= false;