toggle_video_preview.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env python3
  2. #
  3. # Copyright (C) 2015-2017 Savoir-faire Linux Inc.
  4. #
  5. # Author: Eloi Bail <eloi.bail@savoirfairelinux.com>
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  20. #
  21. import dbus
  22. import time
  23. import sys
  24. import os
  25. from random import randint
  26. class DRingToggleVideo():
  27. def start(self):
  28. bus = dbus.SessionBus()
  29. videoControlBus = bus.get_object('org.sflphone.SFLphone', '/org/sflphone/SFLphone/VideoControls')
  30. videoControl = dbus.Interface(videoControlBus, dbus_interface='org.sflphone.SFLphone.VideoControls')
  31. while True:
  32. time.sleep(2)
  33. videoControl.startCamera()
  34. time.sleep(2)
  35. videoControl.stopCamera()