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
1.3 KiB
Go
61 lines
1.3 KiB
Go
//go:build !ci && !wasm && !test_web_driver && !mobile && !tinygo
|
|
|
|
package app
|
|
|
|
/*
|
|
#cgo CFLAGS: -x objective-c
|
|
#cgo LDFLAGS: -framework Foundation
|
|
|
|
#include <stdbool.h>
|
|
#include <stdlib.h>
|
|
|
|
bool isBundled();
|
|
void sendNotification(char *title, char *content);
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"fmt"
|
|
"os/exec"
|
|
"strings"
|
|
"unsafe"
|
|
|
|
"fyne.io/fyne/v2"
|
|
)
|
|
|
|
func (a *fyneApp) SendNotification(n *fyne.Notification) {
|
|
if C.isBundled() {
|
|
titleStr := C.CString(n.Title)
|
|
defer C.free(unsafe.Pointer(titleStr))
|
|
contentStr := C.CString(n.Content)
|
|
defer C.free(unsafe.Pointer(contentStr))
|
|
|
|
C.sendNotification(titleStr, contentStr)
|
|
return
|
|
}
|
|
|
|
fallbackNotification(n.Title, n.Content)
|
|
}
|
|
|
|
func escapeNotificationString(in string) string {
|
|
noSlash := strings.ReplaceAll(in, "\\", "\\\\")
|
|
return strings.ReplaceAll(noSlash, "\"", "\\\"")
|
|
}
|
|
|
|
//export fallbackSend
|
|
func fallbackSend(cTitle, cContent *C.char) {
|
|
title := C.GoString(cTitle)
|
|
content := C.GoString(cContent)
|
|
fallbackNotification(title, content)
|
|
}
|
|
|
|
func fallbackNotification(title, content string) {
|
|
template := `display notification "%s" with title "%s"`
|
|
script := fmt.Sprintf(template, escapeNotificationString(content), escapeNotificationString(title))
|
|
|
|
err := exec.Command("osascript", "-e", script).Start()
|
|
if err != nil {
|
|
fyne.LogError("Failed to launch darwin notify script", err)
|
|
}
|
|
}
|