示例#1
0
    def __init__(self, handle):
        Activity.__init__(self, handle)

        # Self-Enforced max_participants
        self.max_participants = SUGAR_MAX_PARTICIPANTS

        # Prepare Storage Components
        self.network_stack = None
        self.gstreamer_stack = None

        # Set Owner
        self.owner = presenceservice.get_instance().get_owner()

        # Setup GUI
        logger.debug("Preparing GUI")
        self.set_canvas(Gui(self))

        # Setup GStreamer Stack
        logger.debug("Setting up GSTStack")
        self.gststack = GSTStack()
        self.get_canvas().set_gstreamer_stack(self.gststack);

        # Setup Network Stack
        logger.debug("Connect Event to Setup Network Stack on Demand")
        self.establish_activity_sharing(handle)
示例#2
0
    def __init__(self, handle):
        Activity.__init__(self, handle)

        # gobject is used for timeing (will be removed when rtp is implemented)
        gobject.threads_init()

        # Set if they started the activity
        self.isServer = not self._shared_activity

        # Let sugar know we only want a 1 to 1 share (limit to 2 people)
        # Note this is not enforced by sugar yet :(
        self.max_participants = 2

        #FIXME: This is a hack to only allow our ip to be sent once.
        #AKA disables others from double streaming
        if self.isServer:
            # server will send out ip twice, first when joinning empty channel
            # second when the user joins
            self.sent_ip = 2
        else:
            self.sent_ip = 1

        # INITIALIZE GUI
        ################
        self.set_title('OpenVideoChat')

        # Setup Gui
        ###########
        self.gui = Gui(self)
        self.gui.show()
        self.set_canvas(self.gui)

        # Setup Network Stack
        #####################
        self.netstack = SugarNetworkStack(self)
        self._sh_hnd = self.connect('shared', self.netstack.shared_cb)
        self._jo_hnd = self.connect('joined', self.netstack.joined_cb)

        # Setup Pipeline
        #################
        self.gststack = GSTStack( self.gui.send_video_to_screen )
        self.gststack.build_incoming_pipeline()
        gobject.idle_add( self.gststack.start_stop_incoming_pipeline, True )
        
        print "Activity Started"