Пример #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 change_position_callback(self, position):
     from cloudburst.media_manager import MediaManager
     MediaManager.instance().set_video_position(position)