def init_video(video_obj, blank_obj): matID = VT.materialID(video_obj, 'MAvideo') G.video = VT.Texture(video_obj, matID) url = G.expandPath("//media/trailer_400p.ogg") video_source = VT.VideoFFmpeg(url) video_source.repeat = -1 video_source.scale = True video_source.flip = True G.video.source = video_source G.video_screen = video_obj G.video_blank = blank_obj G.video_screen.visible = False
def main(): cont = bge.logic.getCurrentController() obj = cont.owner novideo = cont.actuators["novideo"] try: import VideoTexture print('Playing video. Enjoy!') except: cont.activate(novideo) print('Video failed to play. :(') #if not hasattr(bge.logic, 'video'): matID = VideoTexture.materialID(obj, 'IMplaceholder.jpg') bge.logic.video = VideoTexture.Texture(obj, matID) movie = bge.logic.expandPath("//../textures/videos/team_aurora_intro.ogg") bge.logic.video.source = VideoTexture.VideoFFmpeg(movie) #bge.logic.video.source.scale = True bge.logic.video.source.play() print(movie)
import VideoTexture from bge import logic as GameLogic contr = GameLogic.getCurrentController() obj = contr.owner # -- Check if the "video" property has been defined in the object if 'video' not in obj: #-- Get the material that is using our texture #matID = VideoTexture.materialID(obj, 'MAa_video2014-02-20-17-41-16-163') # -- Create the video texture # GameLogic.video = VideoTexture.Texture(obj, matID) # Suppose 1st material is the video one obj['video'] = VideoTexture.Texture(obj, 0) # -- Get the path to the video file from the 'video_path' object property movie = GameLogic.expandPath(obj['video_path']) # -- Load the file obj['video'].source = VideoTexture.VideoFFmpeg(movie) # play video in loop obj['video'].source.repeat = -1 # -- play the video obj['video'].source.play()
# if video hasn't been added else: # # get matID for the movie screen matID = VideoTexture.materialID(obj, "MA" + obj['material']) # get the texture video = VideoTexture.Texture(obj, matID) movieName = obj['movie'] # get movie path movie = GameLogic.expandPath('c:/Movie/' + movieName) # get movie video.source = VideoTexture.VideoFFmpeg(movie) # set scaling video.source.scale = True # save mirror as an object variable obj["Video"] = video # check for optional loop property if "loop" in obj: # # loop it forever if obj['loop'] == True: # video.source.repeat = -1 # no looping