expo-gliph-player 1.0.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.
- package/LICENSE +21 -0
- package/README.md +348 -0
- package/android/build.gradle +82 -0
- package/android/src/main/AndroidManifest.xml +31 -0
- package/android/src/main/java/com/gliphplayer/DeviceInfoModule.kt +48 -0
- package/android/src/main/java/com/gliphplayer/DeviceInfoPackage.kt +16 -0
- package/android/src/main/java/com/gliphplayer/GliphPlayerModule.kt +360 -0
- package/android/src/main/java/com/gliphplayer/GliphPlayerPackage.kt +48 -0
- package/android/src/main/java/com/gliphplayer/GliphPlayerService.kt +797 -0
- package/android/src/main/res/xml/automotive_app_desc.xml +4 -0
- package/android/src/oldarch/com/gliphplayer/NativeGliphPlayerSpec.kt +56 -0
- package/app.plugin.js +1 -0
- package/expo-gliph-player.podspec +91 -0
- package/ios/GliphAudioPlayer.h +77 -0
- package/ios/GliphAudioPlayer.swift +697 -0
- package/ios/GliphPlayer-Bridging-Header.h +3 -0
- package/ios/GliphPlayerModule.h +12 -0
- package/ios/GliphPlayerModule.mm +243 -0
- package/ios/expo_gliph_player.h +22 -0
- package/lib/commonjs/GliphPlayer.js +310 -0
- package/lib/commonjs/GliphPlayer.js.map +1 -0
- package/lib/commonjs/hooks.js +233 -0
- package/lib/commonjs/hooks.js.map +1 -0
- package/lib/commonjs/index.js +166 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/NativeGliphPlayer.js +19 -0
- package/lib/commonjs/specs/NativeGliphPlayer.js.map +1 -0
- package/lib/commonjs/types.js +175 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/GliphPlayer.js +305 -0
- package/lib/module/GliphPlayer.js.map +1 -0
- package/lib/module/hooks.js +221 -0
- package/lib/module/hooks.js.map +1 -0
- package/lib/module/index.js +20 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/specs/NativeGliphPlayer.js +20 -0
- package/lib/module/specs/NativeGliphPlayer.js.map +1 -0
- package/lib/module/types.js +181 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/src/GliphPlayer.d.ts +113 -0
- package/lib/typescript/src/GliphPlayer.d.ts.map +1 -0
- package/lib/typescript/src/hooks.d.ts +51 -0
- package/lib/typescript/src/hooks.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +11 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeGliphPlayer.d.ts +80 -0
- package/lib/typescript/src/specs/NativeGliphPlayer.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +348 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +62 -0
- package/src/GliphPlayer.ts +356 -0
- package/src/hooks.ts +256 -0
- package/src/index.ts +61 -0
- package/src/specs/NativeGliphPlayer.ts +105 -0
- package/src/types.ts +395 -0
- package/src/withGliphPlayer.js +166 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
package com.gliphplayer
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.*
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* NativeGliphPlayerSpec — Old Architecture fallback.
|
|
7
|
+
*
|
|
8
|
+
* When newArchEnabled=false, this base class is used instead of the
|
|
9
|
+
* TurboModule version in src/newarch. It extends ReactContextBaseJavaModule
|
|
10
|
+
* without implementing TurboModule, so it works on the legacy bridge.
|
|
11
|
+
*/
|
|
12
|
+
abstract class NativeGliphPlayerSpec(reactContext: ReactApplicationContext) :
|
|
13
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
14
|
+
|
|
15
|
+
abstract fun setupPlayer(options: ReadableMap, promise: Promise)
|
|
16
|
+
abstract fun destroy()
|
|
17
|
+
abstract fun isServiceRunning(promise: Promise)
|
|
18
|
+
|
|
19
|
+
abstract fun add(tracks: ReadableArray, insertBeforeIndex: Double, promise: Promise)
|
|
20
|
+
abstract fun remove(tracks: ReadableArray, promise: Promise)
|
|
21
|
+
abstract fun removeUpcomingTracks(promise: Promise)
|
|
22
|
+
abstract fun skip(index: Double, initialPosition: Double, promise: Promise)
|
|
23
|
+
abstract fun skipToNext(initialPosition: Double, promise: Promise)
|
|
24
|
+
abstract fun skipToPrevious(initialPosition: Double, promise: Promise)
|
|
25
|
+
abstract fun move(fromIndex: Double, toIndex: Double, promise: Promise)
|
|
26
|
+
|
|
27
|
+
abstract fun play(promise: Promise)
|
|
28
|
+
abstract fun pause(promise: Promise)
|
|
29
|
+
abstract fun stop(promise: Promise)
|
|
30
|
+
abstract fun reset(promise: Promise)
|
|
31
|
+
abstract fun seekTo(position: Double, promise: Promise)
|
|
32
|
+
abstract fun seekBy(offset: Double, promise: Promise)
|
|
33
|
+
abstract fun setVolume(volume: Double, promise: Promise)
|
|
34
|
+
abstract fun getVolume(promise: Promise)
|
|
35
|
+
abstract fun setRate(rate: Double, promise: Promise)
|
|
36
|
+
abstract fun getRate(promise: Promise)
|
|
37
|
+
abstract fun setRepeatMode(mode: Double, promise: Promise)
|
|
38
|
+
abstract fun getRepeatMode(promise: Promise)
|
|
39
|
+
|
|
40
|
+
abstract fun getQueue(promise: Promise)
|
|
41
|
+
abstract fun getActiveTrackIndex(promise: Promise)
|
|
42
|
+
abstract fun getActiveTrack(promise: Promise)
|
|
43
|
+
abstract fun getTrack(index: Double, promise: Promise)
|
|
44
|
+
abstract fun getQueueSize(promise: Promise)
|
|
45
|
+
|
|
46
|
+
abstract fun getPlaybackState(promise: Promise)
|
|
47
|
+
abstract fun getProgress(promise: Promise)
|
|
48
|
+
|
|
49
|
+
abstract fun updateMetadataForTrack(index: Double, metadata: ReadableMap, promise: Promise)
|
|
50
|
+
abstract fun clearNowPlayingMetadata(promise: Promise)
|
|
51
|
+
abstract fun updateNowPlayingMetadata(metadata: ReadableMap, promise: Promise)
|
|
52
|
+
abstract fun updateOptions(options: ReadableMap, promise: Promise)
|
|
53
|
+
|
|
54
|
+
abstract fun addListener(eventType: String)
|
|
55
|
+
abstract fun removeListeners(count: Double)
|
|
56
|
+
}
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./src/withGliphPlayer');
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "expo-gliph-player"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = "Fixed version of react-native-gliph-player with Expo compatibility"
|
|
9
|
+
s.homepage = "https://github.com/alex303606/expo-gliph-player"
|
|
10
|
+
s.license = "MIT"
|
|
11
|
+
s.authors = { "alex303606" => "alex303606@gmail.com" }
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => "14.0" }
|
|
14
|
+
s.source = { :git => "https://github.com/alex303606/expo-gliph-player.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
# Required because this pod contains Swift. Xcode's generated Swift-ObjC
|
|
17
|
+
# interop header (expo_gliph_player-Swift.h) self-imports
|
|
18
|
+
# <expo_gliph_player/expo_gliph_player.h> — an import that only resolves
|
|
19
|
+
# against a real .framework bundle's own Headers/ folder. Without this,
|
|
20
|
+
# CocoaPods may still build the pod as a plain static library (with the
|
|
21
|
+
# legacy flat Headers/Public/<pod-name>/ layout) even when the host app
|
|
22
|
+
# has `use_frameworks! :linkage => :static` set globally, and the build
|
|
23
|
+
# fails with "'expo_gliph_player/expo_gliph_player.h' file not found".
|
|
24
|
+
s.static_framework = true
|
|
25
|
+
|
|
26
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
27
|
+
s.requires_arc = true
|
|
28
|
+
|
|
29
|
+
# Only expose GliphAudioPlayer.h + expo_gliph_player.h as *public* headers.
|
|
30
|
+
# DEFINES_MODULE makes Xcode build a single Clang module out of every
|
|
31
|
+
# public header, in one consistent language mode. GliphPlayerModule.h
|
|
32
|
+
# transitively pulls in RNGliphPlayerSpec -> ReactCodegen -> Nitro Modules'
|
|
33
|
+
# headers, which require Objective-C++ — mixing that into the module
|
|
34
|
+
# umbrella causes "Could not build Objective-C module 'expo_gliph_player'" /
|
|
35
|
+
# "Could not build module 'ReactCodegen'" / "must be compiled as
|
|
36
|
+
# Obj-C++" / "'utility' file not found". Keeping it (and the bridging
|
|
37
|
+
# header) private avoids pulling that chain into the module build;
|
|
38
|
+
# GliphPlayerModule.mm still sees it fine via a plain quoted #import
|
|
39
|
+
# since it's compiled as part of the same target either way.
|
|
40
|
+
#
|
|
41
|
+
# expo_gliph_player.h is a small master header matching the module's
|
|
42
|
+
# name (dashes -> underscores). Xcode's Swift-generated interop header
|
|
43
|
+
# (expo_gliph_player-Swift.h) hardcodes an import of
|
|
44
|
+
# <expo_gliph_player/expo_gliph_player.h> for any Swift-containing module
|
|
45
|
+
# with DEFINES_MODULE = YES — without a public header with exactly that
|
|
46
|
+
# name, the build fails with "file not found" on that import.
|
|
47
|
+
# Expo's own autolinking post_install step force-disables framework builds
|
|
48
|
+
# for nearly all pods in the project (including this one) when
|
|
49
|
+
# EXPO_USE_PRECOMPILED_MODULES is enabled — it runs *after* CocoaPods
|
|
50
|
+
# applies static_framework/:build_type, so this pod always ends up built
|
|
51
|
+
# as a plain static library with the legacy flat "Headers/Public/<name>/"
|
|
52
|
+
# layout, never as a real .framework. In that layout, CocoaPods names the
|
|
53
|
+
# folder after `s.name` (expo-gliph-player, with a dash) by default, but
|
|
54
|
+
# Xcode's Swift-generated interop header self-imports
|
|
55
|
+
# <expo_gliph_player/expo_gliph_player.h> (module name, with an
|
|
56
|
+
# underscore) — a folder name mismatch that "file not found"s regardless
|
|
57
|
+
# of static_framework. header_dir renames that folder to match.
|
|
58
|
+
s.header_dir = "expo_gliph_player"
|
|
59
|
+
|
|
60
|
+
s.public_header_files = "ios/GliphAudioPlayer.h", "ios/expo_gliph_player.h"
|
|
61
|
+
s.private_header_files = "ios/GliphPlayerModule.h", "ios/GliphPlayer-Bridging-Header.h"
|
|
62
|
+
|
|
63
|
+
install_modules_dependencies(s)
|
|
64
|
+
|
|
65
|
+
s.frameworks = [
|
|
66
|
+
"AVFoundation",
|
|
67
|
+
"MediaPlayer",
|
|
68
|
+
"AudioToolbox",
|
|
69
|
+
"UIKit"
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
s.pod_target_xcconfig = {
|
|
73
|
+
"SWIFT_VERSION" => "5.9",
|
|
74
|
+
"DEFINES_MODULE" => "YES",
|
|
75
|
+
"SWIFT_INSTALL_OBJC_HEADER" => "YES",
|
|
76
|
+
"SWIFT_OBJC_INTERFACE_HEADER_NAME" => "expo_gliph_player-Swift.h",
|
|
77
|
+
# RCT_NEW_ARCH_ENABLED is intentionally NOT forced here — Expo/RN
|
|
78
|
+
# autolinking already defines it project-wide based on whether the
|
|
79
|
+
# host app actually has the new architecture enabled. Hardcoding it
|
|
80
|
+
# to 1 makes this pod always compile the TurboModule codepath even
|
|
81
|
+
# when the host app runs the old (bridge) architecture, which can
|
|
82
|
+
# fail to build or crash at runtime if old-arch codegen wasn't run.
|
|
83
|
+
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited)",
|
|
84
|
+
"OTHER_SWIFT_FLAGS" => "$(inherited)"
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
s.xcconfig = {
|
|
88
|
+
"OTHER_SWIFT_FLAGS" => "$(inherited)",
|
|
89
|
+
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited)"
|
|
90
|
+
}
|
|
91
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <React/RCTBridgeModule.h>
|
|
3
|
+
|
|
4
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
5
|
+
|
|
6
|
+
@interface GliphAudioPlayer : NSObject
|
|
7
|
+
|
|
8
|
+
- (instancetype)initWithEventEmitter:(void (^)(NSString *event, NSDictionary * _Nullable data))eventEmitter;
|
|
9
|
+
|
|
10
|
+
- (void)setupPlayerWithOptions:(NSDictionary *)options
|
|
11
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
12
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
13
|
+
- (void)destroy;
|
|
14
|
+
- (BOOL)isReady;
|
|
15
|
+
|
|
16
|
+
- (void)addTracks:(NSArray *)tracks
|
|
17
|
+
insertBeforeIndex:(NSInteger)insertBeforeIndex
|
|
18
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
19
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
20
|
+
- (void)removeTracks:(NSArray *)trackIds
|
|
21
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
22
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
23
|
+
- (void)removeUpcomingTracksWithResolve:(RCTPromiseResolveBlock)resolve
|
|
24
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
25
|
+
- (void)skipToIndex:(NSInteger)index
|
|
26
|
+
initialPosition:(double)initialPosition
|
|
27
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
28
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
29
|
+
- (void)skipToNextWithInitialPosition:(double)initialPosition
|
|
30
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
31
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
32
|
+
- (void)skipToPreviousWithInitialPosition:(double)initialPosition
|
|
33
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
34
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
35
|
+
- (void)moveFrom:(NSInteger)fromIndex
|
|
36
|
+
toIndex:(NSInteger)toIndex
|
|
37
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
38
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
39
|
+
|
|
40
|
+
- (void)playWithResolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
41
|
+
- (void)pauseWithResolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
42
|
+
- (void)stopWithResolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
43
|
+
- (void)resetWithResolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
44
|
+
- (void)seekTo:(double)position resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
45
|
+
- (void)seekBy:(double)offset resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
46
|
+
- (void)setVolume:(float)volume resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
47
|
+
- (float)getVolume;
|
|
48
|
+
- (void)setRate:(float)rate resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
49
|
+
- (float)getRate;
|
|
50
|
+
- (void)setRepeatMode:(NSInteger)mode resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject;
|
|
51
|
+
- (NSInteger)getRepeatMode;
|
|
52
|
+
|
|
53
|
+
- (NSArray<NSDictionary *> *)getQueue;
|
|
54
|
+
- (NSNumber * _Nullable)getActiveTrackIndex;
|
|
55
|
+
- (NSDictionary * _Nullable)getActiveTrack;
|
|
56
|
+
- (NSDictionary * _Nullable)getTrackAtIndex:(NSInteger)index;
|
|
57
|
+
- (NSInteger)getQueueSize;
|
|
58
|
+
|
|
59
|
+
- (NSDictionary *)getPlaybackState;
|
|
60
|
+
- (NSDictionary *)getProgress;
|
|
61
|
+
|
|
62
|
+
- (void)updateMetadataForTrack:(NSInteger)index
|
|
63
|
+
metadata:(NSDictionary *)metadata
|
|
64
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
65
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
66
|
+
- (void)clearNowPlayingMetadataWithResolve:(RCTPromiseResolveBlock)resolve
|
|
67
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
68
|
+
- (void)updateNowPlayingMetadata:(NSDictionary *)metadata
|
|
69
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
70
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
71
|
+
- (void)updateOptions:(NSDictionary *)options
|
|
72
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
73
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
74
|
+
|
|
75
|
+
@end
|
|
76
|
+
|
|
77
|
+
NS_ASSUME_NONNULL_END
|