Problem with 2 video textures using the same video file

12 August 2017 20:26

I encountered the following problem with video textures: I made a simple scene with two planes having two different animated textures. These textures are using the same video file, however.

In my main js file, I want to pause both textures to prevent them from playing. I use the following code:

 * callback executed when the scene data is loaded
function load_cb(data_id, success) {

    if (!success) {
        console.log("b4w load failure");


    // place your code here

    var Obj01 = m_scenes.get_object_by_name("Obj01");
    var Obj02 = m_scenes.get_object_by_name("Obj02");
    var texname01 = m_tex.get_texture_names(Obj01);
    var texname02 = m_tex.get_texture_names(Obj02);

Chrome's console output gives the following error:

And both textures keep playing. I would expect both textures to not play. Is this a bug or am I missing something?

Best regards. And many thanks for your amazing software!
13 August 2017 08:25
There might be confusion by referring to the same texture on two separate objects.
For debugging, have you tried it using two separate video textures to see if it works?
13 August 2017 11:53
Yes, If I have two separate video textures, the error message goes away.

I attached all files of this version of my example. However, both videos start playing when I launch the page. I think they should be paused after loading the scene, no?!
13 August 2017 13:02
Have a look at the code in the Texture Code Snippet.

video_file.autoplay = true;
            video_file.loop = true;
            video_file.addEventListener("loadeddata", function() {
                draw_video_iter(cube, video_file, ctx_video);
            }, false);

autoplay = true might be default.
13 August 2017 13:56
I had a look at the canvas texture example, but it seems to use a different approach on how to apply the texture. I will look into it if my preferred way (applying the textures within Blender seems much easier) does not work.

Meanwhile, I was playing with more settings. If I disable 'Auto Refresh' for both textures, they seem to start paused. And I can start them with play_video(…) later (for example in the load_cb(…) function).

What I need to fix still (with my Blender way of doing things), is that I don't want to duplicate all the video textures. That would make the loading time of my project unbearable.
Thank you for your help so far, Will!
13 August 2017 17:29
Just a thought…
You can load a materials library and use get_materials_names(obj) to pull materials from it.
You load one object that has all of you materials and use the "Hide" option in the object panel.
Please register or log in to leave a reply.