![]() |
[Kivy] video plays in the background only - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Kivy] video plays in the background only (/thread-42326.html) |
video plays in the background only - Gorashy - Jun-17-2024 I am trying to play video, the video is playing on the background only and no window is shown. this the function that plays the video in a class. class Firstwindow(Screen): def on_pre_enter(self,*args): video= VideoPlayer(source ='react.mp4') video.state ='play' video.allow_fullscreen=True return videokv file <Firstwindow>: canvas: Rectangle: source:"down.jpg" size: self.size name: "home_screen" id: home_screen Button: id: b1 text: 'Beginner' color:"purple" pos:130,300 size_hint:(0.5,0.1) on_release: app.root.current="w_screen" root.manager.transition.direction= "right" Button: id: b2 text:" Inermediate" color:"purple" pos:130,230 size_hint:(0.5,0.1) on_release: app.root.current="menu_screen" root.manager.transition.direction= "right" Button: id: b3 text:"Advanced" color:"purple" pos:130,160 size_hint:(0.5,0.1) on_release: app.root.current="ww" root.manager.transition.direction= "right" RE: video plays in the background only - Gorashy - Jun-17-2024 this the entire code main.py import kivy from kivy.config import Config Config.set('graphics', 'width', '400') Config.set('graphics', 'height', '500') from kivy.app import App from kivy.lang import Builder from kivy.uix.label import Label from kivy.uix.image import Image import sqlite3 from kivy.uix.screenmanager import ScreenManager,Screen import random from kivy.core.audio import SoundLoader from kivy.properties import ObjectProperty from kivy.uix.videoplayer import VideoPlayer from kivy.uix.widget import Widget class Playvideo(Screen): def on_pre_enter(self,*args): video= VideoPlayer(source ='react.mp4') video.state ='play' video.allow_fullscreen=True return video class mywidget(Screen): def pressed(self): self.ids.l1.text="text" class Firstwindow(Screen): pass class Secondwindow(Screen): global x1 global re,re1,re2,re3,re4 db = sqlite3.connect('book.db') cu = db.cursor() cu1= db.cursor() cu2 = db.cursor() cu3 = db.cursor() cu4= db.cursor() choseOption =db.cursor() cu1.execute("select wronganswer1 from intermediate") cu.execute("select questions from intermediate") cu2.execute("select wronganswer2 from intermediate") cu3.execute("select rightanswer from intermediate") cu4.execute("select option from intermediate") re1= cu1.fetchall() re2= cu2.fetchall() re= cu.fetchall() re3 = cu3.fetchall() re4 = cu4.fetchall() def on_pre_enter(self,*args): global theoption x1 = random.randint(1,331) self.ids.record1.text= str (re[x1]) self.ids.ll1.text = str (re1[x1]) self.ids.ll2.text = str (re2[x1]) self.ids.ll3.text = str (re3[x1]) theoption = str(re4[x1]) def build(self): video= VideoPlayer(source ='react.mp4') video.state ='play' video.allow_fullscreen=True return video class Thirdwindow(Screen): global x global results,result1,result2,result3 db = sqlite3.connect('book.db') cur = db.cursor() cur1= db.cursor() cur2 = db.cursor() cur3 = db.cursor() cur1.execute("select wronganswer1 from advanced") cur.execute("select questions from advanced") cur2.execute("select wronganswer2 from advanced") cur3.execute("select rightanswer from advanced") result1= cur1.fetchall() result2= cur2.fetchall() results= cur.fetchall() result3 = cur3.fetchall() def on_pre_enter(self,*args): x = random.randint(1,244) self.ids.record.text = str (results[x]) self.ids.l1.text = str (result1[x]) self.ids.l2.text = str (result2[x]) self.ids.l3.text = str (result3[x]) class Windowfirst(Screen): global r global s,s1,s2,s3 db = sqlite3.connect('book.db') b = db.cursor() b1= db.cursor() b2 = db.cursor() b3 = db.cursor() b1.execute("select wronganswer1 from beginner") b.execute("select questions from beginner") b2.execute("select wronganswer2 from beginner") b3.execute("select rightanswer from beginner") s1= b1.fetchall() s2= b2.fetchall() s= b.fetchall() s3 = b3.fetchall() def on_pre_enter(self,*args): r = random.randint(1,253) self.ids.record3.text = str (s[r]) self.ids.lll1.text = str (s1[r]) self.ids.lll2.text = str (s2[r]) self.ids.lll3.text = str (s3[r]) class WindowManager(ScreenManager): global theoption def screen_manager_method(self): pass class CrashCourse(App): def build(self): Builder.load_file("crashcourse.kv") return WindowManager() if __name__ == '__main__': CrashCourse().run()kv file error message:
RE: video plays in the background only - Gorashy - Jun-18-2024 PS G:\crash course> & C:/Users/gorashy/AppData/Local/Programs/Python/Python312/python.exe "g:/crash course/main.py" [INFO ] [Logger ] Record log in C:\Users\gorashy\.kivy\logs\kivy_24-06-17_15.txt [INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.3.3 [INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.4.0 [INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.3.1 [INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.7.0 [INFO ] [Kivy ] v2.3.0 [INFO ] [Kivy ] Installed at "C:\Users\gorashy\AppData\Local\Programs\Python\Python312\Lib\site-packages\kivy\__init__.py" [INFO ] [Python ] v3.12.3 (tags/v3.12.3:f6650f9, Apr 9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] [INFO ] [Python ] Interpreter at "C:\Users\gorashy\AppData\Local\Programs\Python\Python312\python.exe" [INFO ] [Logger ] Purge log fired. Processing... [INFO ] [Logger ] Purge finished! [INFO ] [Factory ] 195 symbols loaded [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2 (img_pil, img_ffpyplayer ignored) [INFO ] [Text ] Provider: sdl2 [INFO ] [AudioGstplayer] Using Gstreamer 1.18.5.0 [INFO ] [Audio ] Providers: audio_gstplayer, audio_sdl2 (audio_ffpyplayer ignored)[INFO ] [VideoGstplayer] Using Gstreamer 1.18.5.0 [INFO ] [Video ] Provider: gstplayer [INFO ] [Window ] Provider: sdl2 [INFO ] [Window ] Activate GLES2/ANGLE context [INFO ] [GL ] Using the "OpenGL" graphics system [INFO ] [GL ] Backend used <angle_sdl2> [INFO ] [GL ] OpenGL version <b'OpenGL ES 2.0.0 (ANGLE 2.1.21998 git hash: 2eea91f8f0b2)'> [INFO ] [GL ] OpenGL vendor <b'Google Inc. (Intel)'> [INFO ] [GL ] OpenGL renderer <b'ANGLE (Intel, Intel® HD Graphics (0x00000046) Direct3D11 vs_4_0 ps_4_0, D3D11-8.15.10.2900)'> [INFO ] [GL ] OpenGL parsed version: 2, 0 [INFO ] [GL ] Shading version <b'OpenGL ES GLSL ES 1.00 (ANGLE 2.1.21998 git hash: 2eea91f8f0b2)'> [INFO ] [GL ] Texture max size <8192> [INFO ] [GL ] Texture max units <16> [INFO ] [Window ] auto add sdl2 input provider [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked [INFO ] [Base ] Start application main loop [INFO ] [GL ] NPOT texture support is available [WARNING] [Multiple screens named "game_screen"] [<Screen name='game_screen'>, <Screen name='game_screen'>] [WARNING] [Multiple screens named "video"] [<Screen name='video'>, <Screen name='video'>] [ERROR ] [Image ] Error loading <react.mp4> (python.exe:16228): GStreamer-WARNING **: 21:31:10.775: Failed to load plugin 'C:\Users\gorashy\AppData\Local\Programs\Python\Python312\share\gstreamer\bin\gioopenssl.dll': 'C:\Users\gorashy\AppData\Local\Programs\Python\Python312\share\gstreamer\bin\gioopenssl.dll': The specified module could not be found. (python.exe:16228): GStreamer-WARNING **: 21:31:11.912: Failed to load plugin 'C:\Users\gorashy\AppData\Local\Programs\Python\Python312\share\gstreamer\bin\gstrtmp.dll': 'C:\Users\gorashy\AppData\Local\Programs\Python\Python312\share\gstreamer\bin\gstrtmp.dll': The specified module could not be found. (python.exe:16228): GStreamer-WARNING **: 21:31:14.032: Failed to load plugin 'C:\Users\gorashy\AppData\Local\Programs\Python\Python312\share\gstreamer\bin\librtmp-1.dll': 'C:\Users\gorashy\AppData\Local\Programs\Python\Python312\share\gstreamer\bin\librtmp-1.dll': The specified module could not be found. [INFO ] [Base ] Leaving application in progress... PS G:\crash course> RE: video plays in the background only - menator01 - Jun-19-2024 Are you trying to do something like this? test.py from kivy.app import App from kivy.lang import Builder from kivy.uix.screenmanager import ScreenManager, Screen from kivy.uix.videoplayer import VideoPlayer # define the Screens class Window1(Screen): pass class Window2(Screen): pass class Window3(Screen): pass class PlayVideo(Screen): pass class MyWidget(Screen): pass class WindowManager(ScreenManager): pass kv = Builder.load_file('my.kv') class MyApp(App): def build(self): return kv MyApp().run()my.kv
|