diff --git a/qitv-macos-intel.spec b/qitv-macos-intel.spec index 2d957b0..2576901 100644 --- a/qitv-macos-intel.spec +++ b/qitv-macos-intel.spec @@ -46,11 +46,14 @@ app = BUNDLE( icon='assets/qitv.icns', bundle_identifier=None, info_plist={ + 'CFBundleName': 'qitv', + 'CFBundleDisplayName': 'qitv', + 'CFBundleIdentifier': 'com.ozankaraali.qitv', + 'CFBundleVersion': '1.0', + 'CFBundleExecutable': 'qitv', + 'CFBundleIconFile': 'qitv.icns', 'NSPrincipalClass': 'NSApplication', - 'NSAppleScriptEnabled': False, -# 'NSMicrophoneUsageDescription': 'This app requires access to the microphone for audio processing.', -# 'NSCameraUsageDescription': 'This app requires access to the camera for hand gesture detection.', -# 'NSAccessibilityUsageDescription': 'This app requires accessibility permissions to control the mouse using hand gestures.' + 'LSUIElement': True, }, version='0.0.1' -) +) \ No newline at end of file diff --git a/qitv-macos.spec b/qitv-macos.spec index 2d957b0..45851aa 100644 --- a/qitv-macos.spec +++ b/qitv-macos.spec @@ -11,8 +11,8 @@ a = Analysis( pathex=[], binaries=[ (os.path.join(VLC_PATH, 'libvlc.dylib'), '.'), - (os.path.join(VLC_PATH, 'libvlccore.dylib'), '.'), - ], + (os.path.join(VLC_PATH, 'libvlccore.dylib'), '.') + ], datas=[ ('assets/qitv.icns', 'assets/qitv.icns') ], @@ -46,11 +46,14 @@ app = BUNDLE( icon='assets/qitv.icns', bundle_identifier=None, info_plist={ + 'CFBundleName': 'qitv', + 'CFBundleDisplayName': 'qitv', + 'CFBundleIdentifier': 'com.ozankaraali.qitv', + 'CFBundleVersion': '1.0', + 'CFBundleExecutable': 'qitv', + 'CFBundleIconFile': 'qitv.icns', 'NSPrincipalClass': 'NSApplication', - 'NSAppleScriptEnabled': False, -# 'NSMicrophoneUsageDescription': 'This app requires access to the microphone for audio processing.', -# 'NSCameraUsageDescription': 'This app requires access to the camera for hand gesture detection.', -# 'NSAccessibilityUsageDescription': 'This app requires accessibility permissions to control the mouse using hand gestures.' + 'LSUIElement': True, }, version='0.0.1' ) diff --git a/qitv-windows.spec b/qitv-windows.spec index 350c808..4e7df11 100644 --- a/qitv-windows.spec +++ b/qitv-windows.spec @@ -12,6 +12,8 @@ a = Analysis( binaries=[ (os.path.join(VLC_PATH, 'libvlc.dll'), '.'), (os.path.join(VLC_PATH, 'libvlccore.dll'), '.'), + (os.path.join(VLC_PATH, 'axvlc.dll'), '.'), + (os.path.join(VLC_PATH, 'npvlc.dll'), '.'), ], datas=[ ('assets/qitv.ico', 'assets/qitv.ico') diff --git a/video_player.py b/video_player.py index e831aad..3b90997 100644 --- a/video_player.py +++ b/video_player.py @@ -5,7 +5,7 @@ from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QFrame, QWidget from PyQt5.QtGui import QPalette, QColor from PyQt5.QtCore import Qt - +import os class VideoPlayer(QMainWindow): def __init__(self): @@ -17,9 +17,40 @@ def __init__(self): palette.setColor(QPalette.Window, QColor(0, 0, 0)) self.setPalette(palette) - # VLC instance and media player - self.instance = vlc.Instance() - self.mediaplayer = self.instance.media_player_new() + if platform.system() == "Windows": + vlc_path = os.path.join(os.path.dirname(__file__), 'libvlc.dll') # Confirm this path as per your setup + # Ensure the VLC path is set in the environment + os.environ.setdefault('PYTHON_VLC_LIB_PATH', vlc_path) + + # Log the VLC path for debugging + print(f"VLC Path: {vlc_path}") + if platform.system() == "Linux": + vlc_path = os.path.join(os.path.dirname(__file__), 'libvlc.so') + os.environ.setdefault('PYTHON_VLC_LIB_PATH', vlc_path) + print(f"VLC Path: {vlc_path}") + if platform.system() == "Darwin": + vlc_path = os.path.join(os.path.dirname(__file__), 'libvlc.dylib') + os.environ.setdefault('PYTHON_VLC_LIB_PATH', vlc_path) + print(f"VLC Path: {vlc_path}") + + + # Initialize VLC instance + try: + self.instance = vlc.Instance() + if not self.instance: + raise Exception("Failed to create VLC instance") + except Exception as e: + print(f"Exception occurred while creating VLC instance: {e}") + raise + + try: + self.media_player = self.instance.media_player_new() + if not self.media_player: + raise Exception("Failed to create VLC media player") + except Exception as e: + print(f"Exception occurred while creating VLC media player: {e}") + raise + self.proxy_server = None # Main widget and layout @@ -48,8 +79,8 @@ def toggle_fullscreen(self): def closeEvent(self, event): self.save_window_settings() self.save_config() - if self.mediaplayer.is_playing(): - self.mediaplayer.stop() + if self.media_player.is_playing(): + self.media_player.stop() event.accept() def create_video_area(self): @@ -62,25 +93,25 @@ def create_video_area(self): def play_video(self, video_url): if platform.system() == "Linux": - self.mediaplayer.set_xwindow(self.videoframe.winId()) + self.media_player.set_xwindow(self.videoframe.winId()) elif platform.system() == "Windows": - self.mediaplayer.set_hwnd(self.videoframe.winId()) + self.media_player.set_hwnd(self.videoframe.winId()) elif platform.system() == "Darwin": - self.mediaplayer.set_nsobject(int(self.videoframe.winId())) + self.media_player.set_nsobject(int(self.videoframe.winId())) self.media = self.instance.media_new(video_url) - self.mediaplayer.set_media(self.media) - self.mediaplayer.play() + self.media_player.set_media(self.media) + self.media_player.play() def stop_video(self): - self.mediaplayer.stop() + self.media_player.stop() def toggle_play_pause(self): - state = self.mediaplayer.get_state() + state = self.media_player.get_state() if state == vlc.State.Playing: - self.mediaplayer.pause() + self.media_player.pause() else: - self.mediaplayer.play() + self.media_player.play() def load_config(self): try: