Hi everyone, i want to ask if this script could be modified like this (or somehow else). I found this script from http://www.tutorialsforblender3d.com . It let a texture displays a video in your scene but doesnt let it give the sound of that. I separate the video and sound part of that video file and let them load to the game with this… but it doesnt seem to work.
Only when i comment at these lines:
soundName = obj['sound']
sound = aud.Factory.file((bge.logic.expandPath('//sounds/' + soundName))
Thank you in advance
#######################################################
# Movie.py Blender 2.6
#
# Tutorial for using Video.py can be found at
#
# www.tutorialsforblender3d.com
#
# Released under the Creative Commons Attribution 3.0 Unported License.
#
# If you use this code, please include this information header.
#
######################################################
#import bge
import bge
import aud
# get the current controller
controller = bge.logic.getCurrentController()
# get object script is attached to
obj = controller.owner
# check to see variable Video has been created
if "Video" in obj:
# get video
video = obj["Video"]
# update the video
video.refresh(True)
# if variable Video hasn't been created
else:
# get current scene
scene = bge.logic.getCurrentScene()
# get matID for the movie screen
matID = bge.texture.materialID(obj, "MA" + obj['material'])
print(matID)
# get the texture
video = bge.texture.Texture(obj, matID)
# get the name of the movie
movieName = obj['movie']
soundName = obj['sound']
# get movie path
movie = bge.logic.expandPath('//sounds/' + movieName)
sound = aud.Factory.file((bge.logic.expandPath('//sounds/' + soundName))
# get movie
video.source = bge.texture.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()
aud.device().play(sound)
#LE