1
$\begingroup$

I am using this script for playing videos on planes, cubes etc. It is working fine for me, but when I send my runtime to my friends (videos included in the folder), the videos wont show up (only missing texture magenta color).

So I hope somebody can help me that I can play videos in the .exe when my friends start it.

SCRIPT:

#import GameLogic
import GameLogic

# get current scene
scene = GameLogic.getCurrentScene()

# get the current controller
controller = GameLogic.getCurrentController()

# get object script is attached to
obj = controller.owner

# check to see video has been added
if "Video" in obj:

    # get video 
    video = obj["Video"]

    # update the video 
    video.refresh(True)

# if video hasn't been added 
else:

    # import VideoTexture module
    import VideoTexture

    # 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('//' + 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
        else:
            video.source.repeat = 0

    # start the video
    video.source.play()
$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.