Major improvements to UnifiedPlayer: 1. GetFrameImage() now works when paused for responsive UI updates 2. Play() method properly starts FFmpeg process 3. Frame display loop runs continuously for smooth video display 4. Disabled audio temporarily to fix video playback fundamentals 5. Simplified FFmpeg command to focus on video stream only Player now: - Generates video frames correctly - Shows video when paused - Has responsive progress tracking - Starts playback properly Next steps: Re-enable audio playback once video is stable
61 lines
2.2 KiB
Objective-C
61 lines
2.2 KiB
Objective-C
//go:build !ci && !wasm && !test_web_driver && !mobile
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 || TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
|
#import <UserNotifications/UserNotifications.h>
|
|
#endif
|
|
|
|
static int notifyNum = 0;
|
|
|
|
extern void fallbackSend(char *cTitle, char *cBody);
|
|
|
|
bool isBundled() {
|
|
return [[NSBundle mainBundle] bundleIdentifier] != nil;
|
|
}
|
|
|
|
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 || TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
|
void doSendNotification(UNUserNotificationCenter *center, NSString *title, NSString *body) {
|
|
UNMutableNotificationContent *content = [UNMutableNotificationContent new];
|
|
[content autorelease];
|
|
content.title = title;
|
|
content.body = body;
|
|
|
|
notifyNum++;
|
|
NSString *identifier = [NSString stringWithFormat:@"fyne-notify-%d", notifyNum];
|
|
UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:identifier
|
|
content:content trigger:nil];
|
|
|
|
[center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
|
|
if (error != nil) {
|
|
NSLog(@"Could not send notification: %@", error);
|
|
}
|
|
}];
|
|
}
|
|
|
|
void sendNotification(char *cTitle, char *cBody) {
|
|
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
|
|
NSString *title = [NSString stringWithUTF8String:cTitle];
|
|
NSString *body = [NSString stringWithUTF8String:cBody];
|
|
|
|
UNAuthorizationOptions options = UNAuthorizationOptionAlert;
|
|
[center requestAuthorizationWithOptions:options
|
|
completionHandler:^(BOOL granted, NSError *_Nullable error) {
|
|
if (!granted) {
|
|
if (error != NULL) {
|
|
NSLog(@"Error asking for permission to send notifications %@", error);
|
|
// this happens if our app was not signed, so do it the old way
|
|
fallbackSend((char *)[title UTF8String], (char *)[body UTF8String]);
|
|
} else {
|
|
NSLog(@"Unable to get permission to send notifications");
|
|
}
|
|
} else {
|
|
doSendNotification(center, title, body);
|
|
}
|
|
}];
|
|
}
|
|
#else
|
|
void sendNotification(char *cTitle, char *cBody) {
|
|
fallbackSend(cTitle, cBody);
|
|
}
|
|
#endif
|