Jump to content

video with filter issue


kmilinho
 Share

Recommended Posts

Hello, I have a function for playing videos on my game. It works fine, except if I play the same video again, in this case, it just draw like the first frame (or the last)  as an simple image and the video never plays. Differents videos are played without problem.

 

 

State.MainState.prototype.playVideo = function(video, posX, posY){

var video = new Phaser.Video(game, video);

var img = video.addToWorld(posX, posY, 0, 0 , 0.8, 0.8);
var fragmentSrc = [
"precision mediump float;",
"varying vec2 vTextureCoord;",
"uniform sampler2D uSampler;",
"void main(void) {",
"vec2 v1 = vTextureCoord;",
"vec2 v2 = vTextureCoord;",
"v1.y = vTextureCoord.y;",
"v2.y = vTextureCoord.y - 0.5333;",
"vec4 tex1 = texture2D(uSampler, v1);",
"vec4 tex2 = texture2D(uSampler, v2);",
"if(vTextureCoord.y > 0.5315)",
"gl_FragColor = vec4(tex1.r, tex1.g, tex1.b, tex2.r);",
"}"
];
var filter = new Phaser.Filter(game, null, fragmentSrc);
img.filters = [ filter ];
var s = new Phaser.Signal();
s.add(function(){
video.destroy();
img.destroy();
});
video.onComplete = s;
video.play();
};

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...