Beispiel #1
0
def start_video_player(
):  # Starte OMX Videoplayer der am unteren Bildschirmrand angezeigt wird
    # TODO global variablen checken, file_list muss ziemlich sicher nicht global sein,
    #  video_player wahrscheinlich auch nicht, first_time_video_played wird gar nicht benutzt
    global file_list, video_player, index_video, first_time_video_played
    print("Laenge von Filelist: {}".format(len(file_list)))
    t = threading.currentThread()
    index_video = 0
    while getattr(t, "running", True):
        if len(file_list) > 0:
            print("File exists: {}".format(
                os.path.exists(file_list[index_video])))
            if os.path.exists(file_list[index_video]):
                filey = file_list[index_video]
                print("VIDEO Playing {}".format(filey), flush=True)
                t = threading.Event()
                index_video = index_video + 1
                if index_video > len(file_list) - 1:
                    index_video = 0
                try:
                    video_player_playing = video_player.is_playing()
                except:
                    video_player_playing = False

                if not video_player_playing:
                    video_player = OMXPlayer(
                        filey,
                        args=[
                            '--orientation', '270', '--win',
                            '1312,0,1920,1080', '--no-osd', '--vol',
                            '-10000000'
                        ],
                        dbus_name='org.mpris.MeidlaPlayer2.omxplayer1')

                else:
                    video_player.load(filey)

                try:
                    duration_of_video = video_player.duration() + 3
                except:
                    duration_of_video = 3
                    print("duration of video failed", flush=True)

                print(duration_of_video, flush=True)
                video_player.mute()
                if max_people_reached():
                    video_player.hide_video()
                video_player.play_sync()
                sleep(3)
                # sleep(duration_of_video)
            else:
                break
        else:
            break
Beispiel #2
0
def start_video_player():
    global file_list, video_player, index_video, first_time_video_played
    print("Laenge von Filelist: {}".format(len(file_list)))
    t = threading.currentThread()
    index_video = 0
    while getattr(t, "running", True):
        if len(file_list) > 0:
            print("File exists: {}".format(
                os.path.exists(file_list[index_video])))
            if os.path.exists(file_list[index_video]):
                filey = file_list[index_video]
                print("VIDEO Playing {}".format(filey), flush=True)
                t = threading.Event()
                index_video = index_video + 1
                if index_video > len(file_list) - 1:
                    index_video = 0

                try:
                    video_player_playing = video_player.is_playing()
                except:
                    video_player_playing = False
                print(video_player_playing)
                if not video_player_playing:
                    video_player = OMXPlayer(
                        filey,
                        args=[
                            '--orientation', '270', '--win',
                            '1312,0,1920,1080', '--no-osd', '--vol',
                            '-10000000'
                        ],
                        dbus_name='org.mpris.MeidlaPlayer2.omxplayer1')

                else:
                    video_player.load(filey)

                try:
                    duration_of_video = video_player.duration() + 3
                except:
                    duration_of_video = 3
                    print("duration of video failed", flush=True)

                print(duration_of_video, flush=True)
                video_player.mute()
                if max_people_reached():
                    video_player.hide_video()
                video_player.play_sync()
                sleep(3)
                #sleep(duration_of_video)
            else:
                break
        else:
            break