Guest User

Untitled

a guest
Nov 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. class VideoScreen(Screen):
  2. current_video_state = StringProperty()
  3. def __init__(self, **kwargs):
  4. super(VideoScreen, self).__init__(**kwargs)
  5. self.bind(on_touch_down = self._on_stop,
  6. on_eos = self._on_eos) # This binding doesn't works
  7. self.current_video_state = 'play'
  8. # self.dispatch('on_eos')
  9.  
  10. def get_set_current_video_state(self, *args):
  11. while(args):
  12. if args[0] == 'pause':
  13. return 'pause'
  14. return 'play'
  15.  
  16. def _on_stop(self, *args):
  17. self.current_video_state = 'pause'
  18. self.parent.get_screen('Home').language = tr.lang #Set the default language as soon as user taps on video
  19. self.parent.current = 'Login'
  20. self.play_audio()
  21.  
  22. def _on_eos(self, *args):
  23. print("End of video stream detected")
  24. self.current_video_state = 'play'
  25.  
  26. <VideoScreen>:
  27. name: 'Video'
  28. BoxLayout:
  29. Video:
  30. id: 'video1'
  31. source: './media/Sequence_#1.mp4'
  32. state: root.current_video_state
  33. volume: 1
  34. allow_stretch: True
Add Comment
Please, Sign In to add comment