2

I am trying to enable flash in my Quickly app.
I have a WebKit/webview in a scrolledwindow.

I know on Android you need to enable javascript an plugins.

I have look in the WebKit2GTK+ Reference Manual

So my code look like this:

#gets the WebView and scrolledwindow wiget object.  
self.scrolledwindow = builder.get_object("scrolledwindow")  
self.webview = WebKit.WebView()   

#webview->settings.
self.settings = self.webview.get_settings()
self.settings.set_property("enable-plugins", True)
self.settings.set_property("enable-javascript", True)

But it does not work :( Or in fact, I can hear the sound from the video, just not see images.

The terminal response look like this:

finish_initializing  
    self.settings.set_property("enable-javascript", True)  
TypeError: object of type `WebKitWebSettings' does not have property `enable-javascript'  

It can run with out the self.settings.set_property("enable-javascript", True) line, but so again no image on the video.

NB: I'm on my first week with python, so I am a noob to Python ;)

3 Answers 3

1

Here's a rendition of some working code. Note how the settings are instantiated and later the browser is told to set those settings.

    self._browser = webkit.WebView()

    browser_settings=webkit.WebSettings()
    useragent=browser_settings.get_property('user-agent')

    browser_settings.set_property('user-agent', ' '.'abc')
    self._browser.set_settings(browser_settings)

(Looks like the useragent= line is superfluous.)

1
  • John thank you very much :) your code actually helped me lot, I have added an ipod-user-agent then it run on my laptop.. Voidcode ;)
    – Voidcode
    Aug 18, 2012 at 21:48
0

You don't have a variable on the object returned. Terminal has no idea what the "object" is.

1
  • Yes.. but in the WebKit2GTK+ Reference Manual there is property call 'enable-javascript' and it gets no error with the 'enable-plugins'.
    – Voidcode
    Jul 24, 2012 at 2:53
0

After trying John S Gruber´s code.

I try with a ipod-user-agent.

Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10

This works :)

I don´t know how, I´am using an Aspira 5750 Laptop for testing.

It looks like it switch to an default-player, and not the dr.dk´s flash-player. but it works!!

self.webview = WebKit.WebView()

#gets webview.get_settings object.
self.browser_settings = self.webview.get_settings()

self.browser_settings.set_property('user-agent', 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10')

self.webview.set_settings(self.browser_settings)

NB: If I try with user-agent like this Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:14.0) Gecko/20100101 Firefox/14.0.1 Then the video runs slow and do NOT work !!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .