[Android] Support Samsung Air Actions.

Fedor Ihnatkevich git at videolan.org
Tue Nov 3 15:47:10 CET 2020


vlc-android | branch: 3.3.x | Fedor Ihnatkevich <f.giffist at yandex.ru> | Sun Oct 25 23:44:32 2020 +0300| [7ba0c6358a7850da8533a1f7c56362eaf4e4456f] | committer: Nicolas Pomepuy

Support Samsung Air Actions.

Currently standard media session shortcuts
are used for VLC. But they do not support
10 sec rewind/fast forward, so support them directly.
As explicitly supporting actions disabled other shortcuts
for media session on samsung devices, support the rest as well.

(cherry picked from commit 6a171c469ab0ed56ef64358b53e0d705f1ece9c4)

> https://code.videolan.org/videolan/vlc-android/commit/7ba0c6358a7850da8533a1f7c56362eaf4e4456f
---

 .../resources/src/main/res/values/strings.xml      |  7 ++
 application/vlc-android/AndroidManifest.xml        | 10 ++-
 application/vlc-android/res/xml/air_actions.xml    | 85 ++++++++++++++++++++++
 3 files changed, 101 insertions(+), 1 deletion(-)

diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index f1706031e..30bcb853b 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -756,4 +756,11 @@
     <string name="new_group">New group</string>
     <string name="new_group_desc">Create a new group</string>
 
+    <string name="air_action_rewind">Rewind 10 sec</string>
+    <string name="air_action_forward">Seek forward 10 sec</string>
+    <string name="air_action_play_pause">Pause/Resume playback</string>
+    <string name="air_action_volume_up">Volume up</string>
+    <string name="air_action_volume_down">Volume down</string>
+    <string name="air_action_next">Next item in playback</string>
+    <string name="air_action_previous">Previous item in playback</string>
 </resources>
diff --git a/application/vlc-android/AndroidManifest.xml b/application/vlc-android/AndroidManifest.xml
index 97269742d..39e1ad7f1 100644
--- a/application/vlc-android/AndroidManifest.xml
+++ b/application/vlc-android/AndroidManifest.xml
@@ -508,7 +508,15 @@
             android:launchMode="singleTask"
             android:resizeableActivity="true"
             android:supportsPictureInPicture="true"
-            android:theme="@style/Theme.VLC.Player"/>
+            android:theme="@style/Theme.VLC.Player">
+
+            <intent-filter>
+                <action android:name="com.samsung.android.support.REMOTE_ACTION" />
+            </intent-filter>
+            <meta-data android:name="com.samsung.android.support.REMOTE_ACTION"
+                android:resource="@xml/air_actions"/>
+
+        </activity>
         <activity
             android:name=".gui.DialogActivity"
             android:configChanges="orientation|screenSize"
diff --git a/application/vlc-android/res/xml/air_actions.xml b/application/vlc-android/res/xml/air_actions.xml
new file mode 100644
index 000000000..9a6e5cc57
--- /dev/null
+++ b/application/vlc-android/res/xml/air_actions.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<remote-actions version="1.2">
+    <action
+        id="play_pause"
+        label="@string/air_action_play_pause"
+        priority="1"
+        trigger_key="MEDIA_PLAY_PAUSE">
+        <preference
+            name="gesture"
+            value="click" />
+        <preference
+            name="button_only"
+            value="true" />
+    </action>
+
+    <!-- Basic gestures -->
+
+    <action
+        id="next"
+        label="@string/air_action_next"
+        priority="2"
+        trigger_key="MEDIA_NEXT">
+        <preference
+            name="gesture"
+            value="swipe_right" />
+    </action>
+
+    <action
+        id="previous"
+        label="@string/air_action_previous"
+        priority="3"
+        trigger_key="MEDIA_PREVIOUS">
+        <preference
+            name="gesture"
+            value="swipe_left" />
+    </action>
+
+    <!-- Volume gestures -->
+
+    <action
+        id="volume_down"
+        label="@string/air_action_volume_down"
+        priority="4"
+        trigger_key="VOLUME_DOWN">
+        <preference
+            name="gesture"
+            value="swipe_down" />
+        <preference
+            name="motion_only"
+            value="true" />
+    </action>
+    <action
+        id="volume_up"
+        label="@string/air_action_volume_up"
+        priority="5"
+        trigger_key="VOLUME_UP">
+        <preference
+            name="gesture"
+            value="swipe_up" />
+        <preference
+            name="motion_only"
+            value="true" />
+    </action>
+
+    <!-- Seek gestures -->
+
+    <action
+        id="rewind"
+        label="@string/air_action_rewind"
+        priority="6"
+        trigger_key="MEDIA_REWIND">
+        <preference
+            name="gesture"
+            value="circle_ccw" />
+    </action>
+    <action
+        id="seek_forward"
+        label="@string/air_action_forward"
+        priority="7"
+        trigger_key="MEDIA_FAST_FORWARD">
+        <preference
+            name="gesture"
+            value="circle_cw" />
+    </action>
+</remote-actions>



More information about the Android mailing list