@picsa/capacitor-video-player 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CapacitorVideoPlayer.podspec +17 -0
  2. package/LICENSE +21 -0
  3. package/android/build.gradle +71 -0
  4. package/android/src/main/AndroidManifest.xml +3 -0
  5. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/CapacitorVideoPlayer.java +71 -0
  6. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/CapacitorVideoPlayerPlugin.java +1256 -0
  7. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/FullscreenExoPlayerFragment.java +1595 -0
  8. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/Notifications/MyRunnable.java +21 -0
  9. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/Notifications/NotificationCenter.java +61 -0
  10. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/PickerVideo/AdapterVideoList.java +47 -0
  11. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/PickerVideo/ModelVideo.java +49 -0
  12. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/PickerVideo/PickerVideoFragment.java +119 -0
  13. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/PickerVideo/VideoRecyclerViewHolder.java +65 -0
  14. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/Utilities/FilesUtils.java +101 -0
  15. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/Utilities/FragmentUtils.java +32 -0
  16. package/android/src/main/res/.gitkeep +0 -0
  17. package/android/src/main/res/drawable/bg_round_rect_white_50.xml +9 -0
  18. package/android/src/main/res/drawable/bg_rounded_rectangle_white_corner_rounded.xml +10 -0
  19. package/android/src/main/res/drawable/exo_close_btn.xml +12 -0
  20. package/android/src/main/res/drawable/gradient_transparent_middle.xml +12 -0
  21. package/android/src/main/res/drawable/ic_arrow_left.xml +5 -0
  22. package/android/src/main/res/drawable/ic_baseline_lq.xml +7 -0
  23. package/android/src/main/res/drawable/ic_exo_icon_fastforward.xml +35 -0
  24. package/android/src/main/res/drawable/ic_exo_icon_pause.xml +26 -0
  25. package/android/src/main/res/drawable/ic_exo_icon_play.xml +36 -0
  26. package/android/src/main/res/drawable/ic_exo_icon_rewind.xml +35 -0
  27. package/android/src/main/res/drawable/ic_expand.xml +5 -0
  28. package/android/src/main/res/drawable/ic_fit.xml +5 -0
  29. package/android/src/main/res/drawable/ic_image_background.xml +12 -0
  30. package/android/src/main/res/drawable/ic_img_16_9_background.xml +10 -0
  31. package/android/src/main/res/drawable/ic_img_9_16_background.xml +10 -0
  32. package/android/src/main/res/drawable/ic_outline_lock.xml +5 -0
  33. package/android/src/main/res/drawable/ic_outline_lock_open.xml +5 -0
  34. package/android/src/main/res/drawable/ic_pip_white.xml +5 -0
  35. package/android/src/main/res/drawable/ic_views.xml +18 -0
  36. package/android/src/main/res/drawable/ic_zoom.xml +5 -0
  37. package/android/src/main/res/layout/bridge_layout_main.xml +15 -0
  38. package/android/src/main/res/layout/exo_playback_control_view.xml +289 -0
  39. package/android/src/main/res/layout/exoplayer_layout_youtube.xml +361 -0
  40. package/android/src/main/res/layout/fragment_fs_exoplayer.xml +50 -0
  41. package/android/src/main/res/layout/fragment_picker_video.xml +21 -0
  42. package/android/src/main/res/layout/row_video.xml +76 -0
  43. package/android/src/main/res/values/colors.xml +14 -0
  44. package/android/src/main/res/values/strings.xml +3 -0
  45. package/android/src/main/res/values/styles.xml +3 -0
  46. package/dist/docs.json +831 -0
  47. package/dist/esm/definitions.d.ts +322 -0
  48. package/dist/esm/definitions.js +2 -0
  49. package/dist/esm/definitions.js.map +1 -0
  50. package/dist/esm/index.d.ts +4 -0
  51. package/dist/esm/index.js +7 -0
  52. package/dist/esm/index.js.map +1 -0
  53. package/dist/esm/web-utils/video-types.d.ts +16 -0
  54. package/dist/esm/web-utils/video-types.js +15 -0
  55. package/dist/esm/web-utils/video-types.js.map +1 -0
  56. package/dist/esm/web-utils/videoplayer.d.ts +30 -0
  57. package/dist/esm/web-utils/videoplayer.js +315 -0
  58. package/dist/esm/web-utils/videoplayer.js.map +1 -0
  59. package/dist/esm/web.d.ts +123 -0
  60. package/dist/esm/web.js +675 -0
  61. package/dist/esm/web.js.map +1 -0
  62. package/dist/plugin.cjs.js +1017 -0
  63. package/dist/plugin.cjs.js.map +1 -0
  64. package/dist/plugin.js +1019 -0
  65. package/dist/plugin.js.map +1 -0
  66. package/ios/Plugin/CapacitorVideoPlayer.swift +64 -0
  67. package/ios/Plugin/CapacitorVideoPlayerPlugin.h +10 -0
  68. package/ios/Plugin/CapacitorVideoPlayerPlugin.m +22 -0
  69. package/ios/Plugin/CapacitorVideoPlayerPlugin.swift +632 -0
  70. package/ios/Plugin/Extensions/CapacitorVideoPlayerPlugin.AVPlayerViewController.swift +59 -0
  71. package/ios/Plugin/Extensions/CapacitorVideoPlayerPlugin.File.swift +126 -0
  72. package/ios/Plugin/Extensions/CapacitorVideoPlayerPlugin.Fullscreen.swift +94 -0
  73. package/ios/Plugin/Extensions/CapacitorVideoPlayerPlugin.Notifications.swift +140 -0
  74. package/ios/Plugin/Extensions/CapacitorVideoPlayerPlugin.Observers.swift +180 -0
  75. package/ios/Plugin/Info.plist +24 -0
  76. package/ios/Plugin/VideoPicker/VideoHelper.swift +127 -0
  77. package/ios/Plugin/VideoPicker/VideoPickerViewController.swift +144 -0
  78. package/ios/Plugin/VideoPlayer/Extensions/AVURLAsset.swift +18 -0
  79. package/ios/Plugin/VideoPlayer/Extensions/AllOrientationAVPlayerController.swift +12 -0
  80. package/ios/Plugin/VideoPlayer/Extensions/CMTime.swift +23 -0
  81. package/ios/Plugin/VideoPlayer/Extensions/LandscapeAVPlayerController.swift +12 -0
  82. package/ios/Plugin/VideoPlayer/Extensions/Notification.Name.swift +18 -0
  83. package/ios/Plugin/VideoPlayer/Extensions/PortraitAVPlayerController.swift +12 -0
  84. package/ios/Plugin/VideoPlayer/Extensions/View.swift +54 -0
  85. package/ios/Plugin/VideoPlayer/FullScreenVideoPlayerView.swift +601 -0
  86. package/ios/Plugin/VideoPlayer/Models/Video.swift +28 -0
  87. package/ios/Plugin/VideoPlayer/Models/VideoModel.swift +42 -0
  88. package/package.json +92 -0
  89. package/readme.md +190 -0
@@ -0,0 +1,21 @@
1
+ package com.jeep.plugin.capacitor.capacitorvideoplayer.Notifications;
2
+
3
+ import java.util.Map;
4
+
5
+ public class MyRunnable implements Runnable {
6
+
7
+ private Map<String, Object> info;
8
+
9
+ public Map<String, Object> getInfo() {
10
+ return this.info;
11
+ }
12
+
13
+ public void setInfo(Map<String, Object> _info) {
14
+ this.info = _info;
15
+ }
16
+
17
+ @Override
18
+ public void run() {}
19
+
20
+ public void run(Map<String, Object> info) {}
21
+ }
@@ -0,0 +1,61 @@
1
+ package com.jeep.plugin.capacitor.capacitorvideoplayer.Notifications;
2
+
3
+ import java.util.ArrayList;
4
+ import java.util.HashMap;
5
+ import java.util.Iterator;
6
+ import java.util.Map;
7
+
8
+ public class NotificationCenter {
9
+
10
+ //static reference for singleton
11
+ private static NotificationCenter _instance;
12
+
13
+ private HashMap<String, ArrayList<MyRunnable>> registeredObjects;
14
+
15
+ //default c'tor for singleton
16
+ private NotificationCenter() {
17
+ registeredObjects = new HashMap<String, ArrayList<MyRunnable>>();
18
+ }
19
+
20
+ //returning the reference
21
+ public static synchronized NotificationCenter defaultCenter() {
22
+ if (_instance == null) _instance = new NotificationCenter();
23
+ return _instance;
24
+ }
25
+
26
+ public synchronized void addMethodForNotification(String notificationName, MyRunnable r) {
27
+ ArrayList<MyRunnable> list = registeredObjects.get(notificationName);
28
+ if (list == null) {
29
+ list = new ArrayList<MyRunnable>();
30
+ registeredObjects.put(notificationName, list);
31
+ }
32
+ list.add(r);
33
+ }
34
+
35
+ public synchronized void removeMethodForNotification(String notificationName, MyRunnable r) {
36
+ ArrayList<MyRunnable> list = registeredObjects.get(notificationName);
37
+ if (list != null) {
38
+ list.remove(r);
39
+ }
40
+ }
41
+
42
+ public synchronized void removeAllNotifications() {
43
+ for (Iterator<Map.Entry<String, ArrayList<MyRunnable>>> entry = registeredObjects.entrySet().iterator(); entry.hasNext();) {
44
+ Map.Entry<String, ArrayList<MyRunnable>> e = entry.next();
45
+ String key = e.getKey();
46
+ ArrayList<MyRunnable> value = e.getValue();
47
+ removeMethodForNotification(key, value.get(0));
48
+ entry.remove();
49
+ }
50
+ }
51
+
52
+ public synchronized void postNotification(String notificationName, Map<String, Object> _info) {
53
+ ArrayList<MyRunnable> list = registeredObjects.get(notificationName);
54
+ if (list != null) {
55
+ for (MyRunnable r : new ArrayList<>(list)) {
56
+ r.setInfo(_info);
57
+ r.run();
58
+ }
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,47 @@
1
+ package com.jeep.plugin.capacitor.capacitorvideoplayer.PickerVideo;
2
+
3
+ import android.content.Context;
4
+ import android.util.Log;
5
+ import android.view.LayoutInflater;
6
+ import android.view.ViewGroup;
7
+ import androidx.annotation.NonNull;
8
+ import androidx.recyclerview.widget.RecyclerView;
9
+ import com.jeep.plugin.capacitor.capacitorvideoplayer.R;
10
+ import java.util.ArrayList;
11
+
12
+ //public class AdapterVideoList extends RecyclerView.Adapter<AdapterVideoList.MyViewHolder> {
13
+ public class AdapterVideoList extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
14
+
15
+ private static final String TAG = AdapterVideoList.class.getName();
16
+
17
+ ArrayList<ModelVideo> videosList;
18
+ Context context;
19
+ PickerVideoFragment parentFragment;
20
+
21
+ public AdapterVideoList(Context context, PickerVideoFragment parent, ArrayList<ModelVideo> videosList) {
22
+ this.context = context;
23
+ this.videosList = videosList;
24
+ this.parentFragment = parent;
25
+ }
26
+
27
+ @NonNull
28
+ @Override
29
+ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
30
+ return new VideoRecyclerViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.row_video, viewGroup, false));
31
+ }
32
+
33
+ @Override
34
+ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
35
+ ((VideoRecyclerViewHolder) viewHolder).onBind(parentFragment, videosList.get(position));
36
+ }
37
+
38
+ @Override
39
+ public long getItemId(int position) {
40
+ return super.getItemId(position);
41
+ }
42
+
43
+ @Override
44
+ public int getItemCount() {
45
+ return videosList.size();
46
+ }
47
+ }
@@ -0,0 +1,49 @@
1
+ package com.jeep.plugin.capacitor.capacitorvideoplayer.PickerVideo;
2
+
3
+ import android.net.Uri;
4
+
5
+ public class ModelVideo {
6
+
7
+ long id;
8
+ Uri data;
9
+ String title, duration;
10
+
11
+ public ModelVideo(long id, Uri data, String title, String duration) {
12
+ this.id = id;
13
+ this.data = data;
14
+ this.title = title;
15
+ this.duration = duration;
16
+ }
17
+
18
+ public long getId() {
19
+ return id;
20
+ }
21
+
22
+ public void setId(long id) {
23
+ this.id = id;
24
+ }
25
+
26
+ public Uri getData() {
27
+ return data;
28
+ }
29
+
30
+ public void setData(Uri data) {
31
+ this.data = data;
32
+ }
33
+
34
+ public String getTitle() {
35
+ return title;
36
+ }
37
+
38
+ public void setTitle(String title) {
39
+ this.title = title;
40
+ }
41
+
42
+ public String getDuration() {
43
+ return duration;
44
+ }
45
+
46
+ public void setDuration(String duration) {
47
+ this.duration = duration;
48
+ }
49
+ }
@@ -0,0 +1,119 @@
1
+ package com.jeep.plugin.capacitor.capacitorvideoplayer.PickerVideo;
2
+
3
+ //import android.app.Fragment;
4
+ import android.content.ContentUris;
5
+ import android.content.Context;
6
+ import android.database.Cursor;
7
+ import android.net.Uri;
8
+ import android.os.Build;
9
+ import android.os.Bundle;
10
+ import android.provider.MediaStore;
11
+ import android.util.Log;
12
+ import android.view.LayoutInflater;
13
+ import android.view.View;
14
+ import android.view.ViewGroup;
15
+ import androidx.annotation.RequiresApi;
16
+ import androidx.fragment.app.Fragment;
17
+ import androidx.recyclerview.widget.GridLayoutManager;
18
+ import androidx.recyclerview.widget.RecyclerView;
19
+ import com.jeep.plugin.capacitor.capacitorvideoplayer.Notifications.NotificationCenter;
20
+ import com.jeep.plugin.capacitor.capacitorvideoplayer.R;
21
+ import java.util.ArrayList;
22
+ import java.util.HashMap;
23
+ import java.util.Locale;
24
+ import java.util.Map;
25
+
26
+ public class PickerVideoFragment extends Fragment {
27
+
28
+ private static final String TAG = PickerVideoFragment.class.getName();
29
+
30
+ private View view;
31
+ private RecyclerView recyclerView;
32
+ RecyclerView.LayoutManager recyclerViewLayoutManager;
33
+ private Context context;
34
+ private ArrayList<ModelVideo> videosList = new ArrayList<ModelVideo>();
35
+ private AdapterVideoList adapterVideoList;
36
+
37
+ /**
38
+ * Create Fragment View
39
+ * @param inflater
40
+ * @param container
41
+ * @param savedInstanceState
42
+ * @return View
43
+ */
44
+ @SuppressWarnings("serial")
45
+ @RequiresApi(api = Build.VERSION_CODES.M)
46
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
47
+ context = container.getContext();
48
+ // Inflate the layout for this fragment
49
+ view = inflater.inflate(R.layout.fragment_picker_video, container, false);
50
+ loadVideos();
51
+ Log.v(TAG, "*** videosList.size() " + videosList.size());
52
+ if (videosList.size() > 0) {
53
+ recyclerView = view.findViewById(R.id.recyclerView_videos);
54
+ recyclerViewLayoutManager = new GridLayoutManager(context, 2, GridLayoutManager.VERTICAL, false);
55
+ recyclerView.setLayoutManager(recyclerViewLayoutManager);
56
+ adapterVideoList = new AdapterVideoList(context, this, videosList);
57
+ recyclerView.setAdapter(adapterVideoList);
58
+ } else {
59
+ Map<String, Object> info = new HashMap<String, Object>() {
60
+ {
61
+ long videoId = -1;
62
+ put("videoId", videoId);
63
+ }
64
+ };
65
+ Log.v(TAG, "*** info " + info.toString());
66
+ NotificationCenter.defaultCenter().postNotification("videoPathInternalReady", info);
67
+ }
68
+ return view;
69
+ }
70
+
71
+ private void loadVideos() {
72
+ String[] projection = {
73
+ MediaStore.Video.Media._ID,
74
+ MediaStore.Video.Media.DISPLAY_NAME,
75
+ MediaStore.Video.Media.DURATION,
76
+ MediaStore.Video.Media.DATE_ADDED
77
+ };
78
+ String sortOrder = MediaStore.Video.Media.DATE_ADDED + " DESC";
79
+ Uri collection;
80
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
81
+ collection = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL);
82
+ } else {
83
+ collection = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
84
+ }
85
+
86
+ Cursor cursor = getActivity().getApplication().getContentResolver().query(collection, projection, null, null, sortOrder);
87
+ if (cursor != null) {
88
+ int idColumn = cursor.getColumnIndexOrThrow(MediaStore.Video.Media._ID);
89
+ int titleColumn = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DISPLAY_NAME);
90
+ int durationColumn = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DURATION);
91
+
92
+ while (cursor.moveToNext()) {
93
+ long id = cursor.getLong(idColumn);
94
+ String title = cursor.getString(titleColumn);
95
+ int duration = cursor.getInt(durationColumn);
96
+
97
+ Uri data = ContentUris.withAppendedId(collection, id);
98
+
99
+ String duration_formatted;
100
+ int sec = (duration / 1000) % 60;
101
+ int min = (duration / (1000 * 60)) % 60;
102
+ int hrs = duration / (1000 * 60 * 60);
103
+
104
+ if (hrs == 0) {
105
+ duration_formatted = String.valueOf(min).concat(":".concat(String.format(Locale.UK, "%02d", sec)));
106
+ } else {
107
+ duration_formatted =
108
+ String
109
+ .valueOf(hrs)
110
+ .concat(
111
+ ":".concat(String.format(Locale.UK, "%02d", min).concat(":".concat(String.format(Locale.UK, "%02d", sec))))
112
+ );
113
+ }
114
+ Log.v(TAG, "**** video " + id + " " + title + " " + duration_formatted + " ****");
115
+ videosList.add(new ModelVideo(id, data, title, duration_formatted));
116
+ }
117
+ }
118
+ }
119
+ }
@@ -0,0 +1,65 @@
1
+ package com.jeep.plugin.capacitor.capacitorvideoplayer.PickerVideo;
2
+
3
+ import android.util.Log;
4
+ import android.view.View;
5
+ import android.widget.ImageView;
6
+ import android.widget.TextView;
7
+ import androidx.annotation.NonNull;
8
+ import androidx.recyclerview.widget.RecyclerView;
9
+ import com.jeep.plugin.capacitor.capacitorvideoplayer.Notifications.NotificationCenter;
10
+ import com.jeep.plugin.capacitor.capacitorvideoplayer.R;
11
+ import com.squareup.picasso.Picasso;
12
+ import java.util.HashMap;
13
+ import java.util.Map;
14
+
15
+ public class VideoRecyclerViewHolder extends RecyclerView.ViewHolder {
16
+
17
+ private static final String TAG = VideoRecyclerViewHolder.class.getName();
18
+ ImageView tv_thumbnail;
19
+ TextView tv_title, tv_duration;
20
+ View parent;
21
+
22
+ public VideoRecyclerViewHolder(@NonNull View itemView) {
23
+ super(itemView);
24
+ parent = itemView;
25
+ tv_title = itemView.findViewById(R.id.tv_title);
26
+ tv_duration = itemView.findViewById(R.id.tv_duration);
27
+ tv_thumbnail = itemView.findViewById(R.id.tv_thumbnail);
28
+ }
29
+
30
+ public void onBind(PickerVideoFragment parentFragment, final ModelVideo modelVideo) {
31
+ parent.setTag(this);
32
+
33
+ tv_title.setText(modelVideo.getTitle());
34
+ tv_duration.setText(modelVideo.getDuration());
35
+
36
+ parentFragment
37
+ .getActivity()
38
+ .runOnUiThread(
39
+ new Runnable() {
40
+ @Override
41
+ public void run() {
42
+ Picasso.get().load(modelVideo.getData()).placeholder(R.drawable.ic_image_background).fit().into(tv_thumbnail);
43
+ }
44
+ }
45
+ );
46
+
47
+ parent.setOnClickListener(
48
+ new View.OnClickListener() {
49
+ @SuppressWarnings("serial")
50
+ @Override
51
+ public void onClick(View v) {
52
+ Map<String, Object> info = new HashMap<String, Object>() {
53
+ {
54
+ long videoId = modelVideo.getId();
55
+ Log.v(TAG, "**** in onBindViewHolder videoId: " + videoId + " ****");
56
+ put("videoId", videoId);
57
+ }
58
+ };
59
+ NotificationCenter.defaultCenter().postNotification("videoPathInternalReady", info);
60
+ }
61
+ }
62
+ );
63
+ return;
64
+ }
65
+ }
@@ -0,0 +1,101 @@
1
+ package com.jeep.plugin.capacitor.capacitorvideoplayer.Utilities;
2
+
3
+ import android.content.Context;
4
+ import android.util.Log;
5
+ import java.io.File;
6
+
7
+ public class FilesUtils {
8
+
9
+ private static final String TAG = "FilesUtils";
10
+ private final Context context;
11
+
12
+ public FilesUtils(Context context) {
13
+ this.context = context;
14
+ }
15
+
16
+ public String getFilePath(String url) {
17
+ if (url.startsWith("file:///")) {
18
+ return url;
19
+ }
20
+
21
+ if (url.contains("/_capacitor_file_/")) {
22
+ return resolveCapacitorFilePath(url);
23
+ } else if (url.startsWith("http")) {
24
+ return url;
25
+ } else if (url.startsWith("application")) {
26
+ return resolveApplicationPath(url);
27
+ } else if (url.contains("assets")) {
28
+ return "file:///android_asset/" + url;
29
+ }
30
+
31
+ return null;
32
+ }
33
+
34
+ // Resolves a _capacitor_file_ URL to a validated file:// path.
35
+ // Capacitor's convertFileSrc() produces: http://localhost/_capacitor_file_/absolute/path
36
+ // The extracted path is canonicalized and verified to stay within the app's
37
+ // internal data dir or external files dir before being returned.
38
+ private String resolveCapacitorFilePath(String url) {
39
+ int prefixIndex = url.indexOf("/_capacitor_file_");
40
+ if (prefixIndex == -1) {
41
+ return null;
42
+ }
43
+
44
+ String filePath = url.substring(prefixIndex + "/_capacitor_file_".length());
45
+ try {
46
+ filePath = java.net.URLDecoder.decode(filePath, "UTF-8");
47
+ } catch (java.io.UnsupportedEncodingException e) {
48
+ // UTF-8 is always supported on Android; fall through with the raw path
49
+ Log.e(TAG, "Failed to decode Capacitor file URL, using raw path: " + url, e);
50
+ }
51
+
52
+ try {
53
+ // Validate that the resolved path is within app boundaries
54
+ String resolvedPath = new File(filePath).getCanonicalPath();
55
+ String dataDir = context.getDataDir().getCanonicalPath();
56
+ File externalFilesDir = context.getExternalFilesDir(null);
57
+
58
+ if (isPathWithinDirectory(resolvedPath, dataDir)
59
+ || (externalFilesDir != null && isPathWithinDirectory(resolvedPath, externalFilesDir.getCanonicalPath()))) {
60
+ return "file://" + resolvedPath;
61
+ }
62
+
63
+ Log.e(TAG, "Blocked path outside app boundaries: " + url);
64
+ } catch (java.io.IOException e) {
65
+ Log.e(TAG, "Failed to resolve Capacitor file path: " + url, e);
66
+ }
67
+
68
+ return null;
69
+ }
70
+
71
+ // Resolves an application:// URL to a validated path within getFilesDir().
72
+ // Extracts the relative segment after the last "files/", joins it onto
73
+ // the app's files directory, then canonicalizes and validates before returning.
74
+ private String resolveApplicationPath(String url) {
75
+ int filesIndex = url.lastIndexOf("files/");
76
+ if (filesIndex == -1) {
77
+ return null;
78
+ }
79
+
80
+ try {
81
+ String filesDir = context.getFilesDir().getCanonicalPath();
82
+ String relativePath = url.substring(filesIndex + 6);
83
+ String resolvedPath = new File(filesDir, relativePath).getCanonicalPath();
84
+
85
+ if (isPathWithinDirectory(resolvedPath, filesDir) && new File(resolvedPath).exists()) {
86
+ return resolvedPath;
87
+ }
88
+ } catch (java.io.IOException e) {
89
+ Log.e(TAG, "Failed to resolve application URL path: " + url, e);
90
+ }
91
+
92
+ return null;
93
+ }
94
+
95
+ // Returns true if canonicalPath is strictly inside canonicalBaseDir.
96
+ // The separator is appended to the base before the check so that
97
+ // e.g. /data/data/com.app does not match /data/data/com.app.evil
98
+ private boolean isPathWithinDirectory(String canonicalPath, String canonicalBaseDir) {
99
+ return canonicalPath.startsWith(canonicalBaseDir + File.separator);
100
+ }
101
+ }
@@ -0,0 +1,32 @@
1
+ package com.jeep.plugin.capacitor.capacitorvideoplayer.Utilities;
2
+
3
+ import androidx.fragment.app.Fragment;
4
+ import androidx.fragment.app.FragmentManager;
5
+ import androidx.fragment.app.FragmentTransaction;
6
+ import com.getcapacitor.Bridge;
7
+
8
+ public class FragmentUtils {
9
+
10
+ private Bridge bridge;
11
+
12
+ public FragmentUtils(Bridge bridge) {
13
+ this.bridge = bridge;
14
+ }
15
+
16
+ public void loadFragment(Fragment vpFragment, int frameLayoutId) {
17
+ // create a FragmentManager
18
+ FragmentManager fm = bridge.getActivity().getSupportFragmentManager();
19
+ // create a FragmentTransaction to begin the transaction and replace the Fragment
20
+ FragmentTransaction fragmentTransaction = fm.beginTransaction();
21
+ // replace the FrameLayout with new Fragment
22
+ fragmentTransaction.replace(frameLayoutId, vpFragment);
23
+ fragmentTransaction.commit(); // save the changes
24
+ }
25
+
26
+ public void removeFragment(/*VideoPlayerFragmentFullscreenExoPlayer*/Fragment vpFragment) {
27
+ FragmentManager fm = bridge.getActivity().getSupportFragmentManager();
28
+ FragmentTransaction fragmentTransaction = fm.beginTransaction();
29
+ fragmentTransaction.remove(vpFragment);
30
+ fragmentTransaction.commit();
31
+ }
32
+ }
File without changes
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <shape xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:shape="rectangle">
4
+ <stroke
5
+ android:width="1.2dp"
6
+ android:color="@color/white_50"/>
7
+ <solid android:color="@color/transparent"/>
8
+ <corners android:radius="25dp"/>
9
+ </shape>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <shape xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:shape="rectangle"
4
+ >
5
+ <solid android:color="#fff"/>
6
+
7
+ <corners android:radius="200dp"
8
+ />
9
+
10
+ </shape>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <selector xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <item>
4
+ <shape android:shape="rectangle">
5
+ <corners android:radius="8dp"/>
6
+ <solid android:width="1dip" android:color="@android:color/transparent"/>
7
+ <stroke
8
+ android:width="3px"
9
+ android:color="@android:color/white" />
10
+ </shape>
11
+ </item>
12
+ </selector>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <item android:gravity="bottom">
4
+ <shape android:shape="rectangle">
5
+ <gradient
6
+ android:centerColor="@color/black_50"
7
+ android:endColor="@color/black_50"
8
+ android:startColor="@color/black_50" />
9
+ </shape>
10
+ </item>
11
+
12
+ </layer-list>
@@ -0,0 +1,5 @@
1
+ <vector android:autoMirrored="true" android:height="24dp"
2
+ android:tint="#FFFFFF" android:viewportHeight="24"
3
+ android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
4
+ <path android:fillColor="@android:color/white" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
5
+ </vector>
@@ -0,0 +1,7 @@
1
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
2
+ android:height="24dp"
3
+ android:width="24dp"
4
+ android:viewportWidth="24"
5
+ android:viewportHeight="24">
6
+ <path android:fillColor="#FFF" android:pathData="M14.5,13.5H16.5V10.5H14.5M18,14C18,14.6 17.6,15 17,15H16.25V16.5H14.75V15H14C13.4,15 13,14.6 13,14V10C13,9.4 13.4,9 14,9H17C17.6,9 18,9.4 18,10M19,4H5A2,2 0 0,0 3,6V18A2,2 0 0,0 5,20H19A2,2 0 0,0 21,18V6A2,2 0 0,0 19,4M11,13.5V15H6V9H7.5V13.5H11Z" />
7
+ </vector>
@@ -0,0 +1,35 @@
1
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
2
+ android:width="40dp"
3
+ android:height="40dp"
4
+ android:viewportWidth="40"
5
+ android:viewportHeight="40">
6
+ <path
7
+ android:pathData="M20,20m-20,0a20,20 0,1 1,40 0a20,20 0,1 1,-40 0"
8
+ android:strokeAlpha="0.5"
9
+ android:strokeWidth="1"
10
+ android:fillColor="#000000"
11
+ android:fillType="evenOdd"
12
+ android:strokeColor="#00000000"
13
+ android:fillAlpha="0.5"/>
14
+ <path
15
+ android:pathData="M30,20.7187C30,26.2415 25.5228,30.7187 20,30.7187C14.4772,30.7187 10,26.2415 10,20.7187C10,15.1958 14.4772,10.7187 20,10.7187L22.3601,10.7187"
16
+ android:strokeWidth="1.5"
17
+ android:fillColor="#00000000"
18
+ android:strokeColor="#FFFFFF"
19
+ android:fillType="evenOdd"
20
+ android:strokeLineCap="round"/>
21
+ <path
22
+ android:pathData="M23,11L19,7L23,11ZM23,11L19,15L23,11Z"
23
+ android:strokeLineJoin="round"
24
+ android:strokeWidth="1.5"
25
+ android:fillColor="#00000000"
26
+ android:strokeColor="#FFFFFF"
27
+ android:fillType="evenOdd"
28
+ android:strokeLineCap="round"/>
29
+ <path
30
+ android:pathData="M16.876,18.9187C17.276,18.86 17.628,18.7187 17.932,18.4947L18.644,18.4947L18.644,23.7187L17.7,23.7187L17.7,19.6227C17.428,19.756 17.1533,19.8227 16.876,19.8227L16.876,18.9187ZM21.424,18.4227C21.744,18.4227 22.036,18.4773 22.3,18.5867C22.564,18.696 22.7893,18.8627 22.976,19.0867C23.3813,19.5613 23.584,20.2413 23.584,21.1267C23.584,22.012 23.3813,22.692 22.976,23.1667C22.6027,23.6093 22.088,23.8307 21.432,23.8307C20.7707,23.8307 20.2507,23.6093 19.872,23.1667C19.472,22.7027 19.272,22.0227 19.272,21.1267C19.272,20.2307 19.472,19.5507 19.872,19.0867C20.2507,18.644 20.768,18.4227 21.424,18.4227ZM22.608,21.1267C22.608,20.5293 22.5053,20.072 22.3,19.7547C22.0947,19.4373 21.804,19.2787 21.428,19.2787C21.052,19.2787 20.7613,19.4373 20.556,19.7547C20.3507,20.072 20.248,20.5293 20.248,21.1267C20.248,21.724 20.3507,22.1787 20.556,22.4907C20.7613,22.8027 21.052,22.9587 21.428,22.9587C21.804,22.9587 22.0947,22.8027 22.3,22.4907C22.5053,22.1787 22.608,21.724 22.608,21.1267Z"
31
+ android:strokeWidth="1"
32
+ android:fillColor="#FFFFFF"
33
+ android:fillType="nonZero"
34
+ android:strokeColor="#00000000"/>
35
+ </vector>
@@ -0,0 +1,26 @@
1
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
2
+ android:width="56dp"
3
+ android:height="56dp"
4
+ android:viewportWidth="56"
5
+ android:viewportHeight="56">
6
+ <path
7
+ android:pathData="M28,28m-28,0a28,28 0,1 1,56 0a28,28 0,1 1,-56 0"
8
+ android:strokeAlpha="0.5"
9
+ android:strokeWidth="1"
10
+ android:fillColor="#000000"
11
+ android:fillType="evenOdd"
12
+ android:strokeColor="#00000000"
13
+ android:fillAlpha="0.5"/>
14
+ <path
15
+ android:pathData="M23,17L23,17A3,3 0,0 1,26 20L26,36A3,3 0,0 1,23 39L23,39A3,3 0,0 1,20 36L20,20A3,3 0,0 1,23 17z"
16
+ android:strokeWidth="1"
17
+ android:fillColor="#FFFFFF"
18
+ android:fillType="evenOdd"
19
+ android:strokeColor="#00000000"/>
20
+ <path
21
+ android:pathData="M34,17L34,17A3,3 0,0 1,37 20L37,36A3,3 0,0 1,34 39L34,39A3,3 0,0 1,31 36L31,20A3,3 0,0 1,34 17z"
22
+ android:strokeWidth="1"
23
+ android:fillColor="#FFFFFF"
24
+ android:fillType="evenOdd"
25
+ android:strokeColor="#00000000"/>
26
+ </vector>
@@ -0,0 +1,36 @@
1
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
2
+ android:width="56dp"
3
+ android:height="56dp"
4
+ android:viewportWidth="56"
5
+ android:viewportHeight="56">
6
+ <path
7
+ android:pathData="M28,28m-28,0a28,28 0,1 1,56 0a28,28 0,1 1,-56 0"
8
+ android:strokeAlpha="0.5"
9
+ android:strokeWidth="1"
10
+ android:fillColor="#000000"
11
+ android:fillType="evenOdd"
12
+ android:strokeColor="#00000000"
13
+ android:fillAlpha="0.5"/>
14
+ <path
15
+ android:pathData="M28,28m-15,0a15,15 0,1 1,30 0a15,15 0,1 1,-30 0"
16
+ android:strokeAlpha="0"
17
+ android:strokeWidth="1"
18
+ android:fillColor="#D8D8D8"
19
+ android:fillType="evenOdd"
20
+ android:strokeColor="#00000000"
21
+ android:fillAlpha="0"/>
22
+ <path
23
+ android:pathData="M29.5,28.5m-13.5,0a13.5,13.5 0,1 1,27 0a13.5,13.5 0,1 1,-27 0"
24
+ android:strokeAlpha="0"
25
+ android:strokeWidth="1"
26
+ android:fillColor="#D8D8D8"
27
+ android:fillType="evenOdd"
28
+ android:strokeColor="#00000000"
29
+ android:fillAlpha="0"/>
30
+ <path
31
+ android:pathData="M39.9195,29.7411L22.9841,39.3133C22.0225,39.8568 20.8024,39.5179 20.2589,38.5563C20.0892,38.2561 20,37.9171 20,37.5722L20,18.4278C20,17.3232 20.8954,16.4278 22,16.4278C22.3449,16.4278 22.6839,16.517 22.9841,16.6867L39.9195,26.2589C40.8811,26.8024 41.2201,28.0225 40.6766,28.9841C40.4977,29.3006 40.236,29.5623 39.9195,29.7411Z"
32
+ android:strokeWidth="1"
33
+ android:fillColor="#FFFFFF"
34
+ android:fillType="nonZero"
35
+ android:strokeColor="#00000000"/>
36
+ </vector>