Youtube in Webkit/Python/GTK app
Question: I'm trying to do a python(2.7)/GTK+ app, and I have a window, containing a
WebKit WebView.

    
    
    from gi.repository import Gtk, WebKit
    
    class MainWindow:
        def __init__( self ):
            self.builder = Gtk.Builder()
            self.builder.add_from_file("youtubeWindow.ui")
            self.main_window = self.builder.get_object("main_window")
            self.scrl_window = self.builder.get_object("scrl_window")
            self.webview = WebKit.WebView()
            self.scrl_window.add(self.webview)
            self.webview.show()  
            self.webview.open("http://youtu.be/o-akcEzQ6Y8")  
            self.main_window.show_all()      
            Gtk.main()     
    
    
    tube_window = MainWindow() 
    

When I run my app I get the folowing error:

> ERROR: Invalid browser function table. Some functionality may be restricted.
> java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.3)
> (6b24-1.11.3-1ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 20.0-b12,
> mixed mode) ** Message: console message: undefined @0: TypeError:
> 'undefined' is not an object

The page loads, but I can't play my video :( (The video box is all black and
doesn't have any play button, nothing)

The UI is made in Glade and the XML file generated by Glade, youtubeWindow.ui
is:

    
    
    <?xml version="1.0" encoding="UTF-8"?>
    <interface>
      <!-- interface-requires gtk+ 3.0 -->
      <object class="GtkWindow" id="main_window">
        <property name="can_focus">False</property>
        <property name="type_hint">menu</property>
        <child>
          <object class="GtkScrolledWindow" id="scrl_window">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="shadow_type">in</property>
            <child>
              <placeholder/>
            </child>
          </object>
        </child>
      </object>
    </interface>
    

Can you please help me? Thanks!


Answer: I've found the solution to your problem. The error message from OpenJDK is
irrevelant, it comes from the Java browser plugin and has no effect on what
you're trying to do.

Far more important, you make a simple mistake. You simply don't show your
window! Add a

    
    
    self.main_window.show_all()
    

before the call to `Gtk.main()` and your window is shown, Youtube video
playback starts and everything works properly.

