Пример #1
0
    def __init__(self):

        self.running = True

        sys.excepthook = exceptionHook
        applicationsettings = dict()

        if self.CEF_DEBUG:
            window.g_debug = True
            applicationsettings['debug'] = True
            applicationsettings['release_dcheck_enabled'] = True

        applicationsettings['log_file'] = getApplicationPath('debug.log')
        applicationsettings['log_severity'] = cefpython.LOGSEVERITY_INFO
        applicationsettings['browser_subprocess_path'] = '%s/%s' % (cefpython.GetModuleDirectory(), 'subprocess')
        cefpython.Initialize(applicationsettings)

        browsersettings = dict()
        browsersettings['file_access_from_file_urls_allowed'] = True
        browsersettings['universal_access_from_file_urls_allowed'] = True

        windowhandles = {
            win32con.WM_CLOSE: self.close_window,
            win32con.WM_DESTROY: self.quit,
            win32con.WM_SIZE: cefpython.WindowUtils.OnSize,
            win32con.WM_SETFOCUS: cefpython.WindowUtils.OnSetFocus,
            win32con.WM_ERASEBKGND: cefpython.WindowUtils.OnEraseBackground
        }

        windowhandle = window.createWindow(title='Cloudburst', className='Cloudburst', width=800, height=700,
                                           icon=getApplicationPath('res/images/cloudburst.ico'), windowHandle=windowhandles)

        windowinfo = cefpython.WindowInfo()
        windowinfo.SetAsChild(windowhandle)
        browser = cefpython.CreateBrowserSync(windowinfo, browsersettings, navigateUrl=getApplicationPath("res/views/vlc-test.html"))

        jsbindings = cefpython.JavascriptBindings(bindToFrames=False, bindToPopups=True)
        # jsBindings.SetProperty("pyProperty", "This was set in Python") # TODO figure out how to set these properties in js
        # self.jsBindings.SetProperty("pyConfig", ["This was set in Python",
        #         {"name": "Nested dictionary", "isNested": True},
        #         [1,"2", None]])

        self.vlc = VLC.instance()
        self.vlc.set_browser(browser)

        jsbindings.SetObject("python", self.vlc)
        browser.SetJavascriptBindings(jsbindings)

        browser.SetClientCallback("OnLoadEnd", self.on_load_end)

        media_manager = MediaManager.instance()

        # blocking loop
        cefpython.MessageLoop()
        cefpython.Shutdown()


        # Shuts down threads and cancels running timers (these would otherwise block)
        media_manager.shutdown()
        print 'Shutdown complete'
Пример #2
0
    def __init__(self):

        self.vlc = VLC.instance()                   # Get the singleton instance

        self.running = True

        # init vars, should not be edited
        self.play_timer = None                      # timer, VLC will attempt to play the file every time this is called
        self.buffer_timer = None                    # timer, time between checks if a) the file exists and b) the header is available
        self.forward_buffer_timer = None            # timer, tiem between checks if the forward buffer (only for MKV) is available
        self.forward_buffer_available = False       # True if MKV can start playing from a seekpoint
        self.video_file_exists = False              # True if video file is present on disk. Use this bool to prevent unnecessary disk access
        self.header_available = False               # True if header info of the video file is downloaded
        self.seekpoint_available = False            # True if a buffer exists from the seek point onward
        self.desired_seekpoint = 0                  # from 0 to 1, the point where the video wishes to play from
        self.previous_video_position = None         # To determine if video is actually playing (based on media position difference)
        self.video_path = None
Пример #3
0
    def __init__(self):

        self.vlc = VLC.instance()  # Get the singleton instance

        self.running = True

        # init vars, should not be edited
        self.play_timer = None  # timer, VLC will attempt to play the file every time this is called
        self.buffer_timer = None  # timer, time between checks if a) the file exists and b) the header is available
        self.forward_buffer_timer = None  # timer, tiem between checks if the forward buffer (only for MKV) is available
        self.forward_buffer_available = False  # True if MKV can start playing from a seekpoint
        self.video_file_exists = False  # True if video file is present on disk. Use this bool to prevent unnecessary disk access
        self.header_available = False  # True if header info of the video file is downloaded
        self.seekpoint_available = False  # True if a buffer exists from the seek point onward
        self.desired_seekpoint = 0  # from 0 to 1, the point where the video wishes to play from
        self.previous_video_position = None  # To determine if video is actually playing (based on media position difference)
        self.video_path = None