kodi
JNIXBMCMediaSession.h
1 /*
2  * Copyright (C) 2017 Christian Browet
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include <androidjni/Intent.h>
12 #include <androidjni/JNIBase.h>
13 #include <androidjni/MediaMetadata.h>
14 #include <androidjni/PlaybackState.h>
15 
16 namespace jni
17 {
18 
19 class CJNIXBMCMediaSession : public CJNIBase, public CJNIInterfaceImplem<CJNIXBMCMediaSession>
20 {
21 public:
24  CJNIXBMCMediaSession(const jni::jhobject &object) : CJNIBase(object) {}
25  ~CJNIXBMCMediaSession() override;
26 
27  static void RegisterNatives(JNIEnv* env);
28 
29  void activate(bool state);
30  void updatePlaybackState(const CJNIPlaybackState& state);
31  void updateMetadata(const CJNIMediaMetadata& myData);
32  void updateIntent(const CJNIIntent& intent);
33 
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;
44 
45 protected:
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);
55 
56  bool m_isActive = false;
57 };
58 
59 }
Definition: JNIXBMCMediaSession.h:19
Definition: JNIMainActivity.h:15
Definition: LibInputPointer.h:13