Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Constrain view with video

I am getting this error…
[ERROR] Trying to constraint a view without a proxy's layout.

…when I hit the done button on my video.

The only thing I am doing when hitting done is this:

activeMovie.addEventListener('complete',function(e)
{
    Ti.API.info(e);
});

Any ideas?

— asked November 1st 2010 by Ronnie Swietek
  • constrain
  • error
  • view
0 Comments

7 Answers

  • Also this is my video object

    var activeMovie = Titanium.Media.createVideoPlayer({
        contentURL: video,
        backgroundColor:'#000',
        fullscreen:true,
        movieControlMode:Titanium.Media.VIDEO_CONTROL_FULLSCREEN,
        scalingMode:Titanium.Media.VIDEO_SCALING_MODE_FILL
    });
    
    — answered November 1st 2010 by Ronnie Swietek
    permalink
    0 Comments
  • So this happens to nobody?

    — answered November 1st 2010 by Ronnie Swietek
    permalink
    0 Comments
  • bump

    — answered November 2nd 2010 by Ronnie Swietek
    permalink
    0 Comments
  • I can't reproduce what you are seeing. What version of the mobile SDK are you using? Is there more to that code that just the movie? How are you attaching it to a view or window?

    — answered November 2nd 2010 by John McKnight
    permalink
    0 Comments
  • This is my full video.js file. I changed the video object a little bit. The error is still present, however, it actually closes the window now rather than just going black. I am using SDK 4.0

    var win         = Titanium.UI.currentWindow;
    var video        = win.video;
    
    var activeMovie = Titanium.Media.createVideoPlayer({
        contentURL: video,
        backgroundColor:'#000',
        fullscreen:true
    });
    win.add(activeMovie);
    
    activeMovie.addEventListener('complete', function(e)
    {
        Ti.App.fireEvent("finishMovie");
        win.orientationModes = [Titanium.UI.PORTRAIT];
    });
    
    activeMovie.addEventListener('fullscreen', function(e)
    {
        if (!e.entering)
        {
            activeMovie.stop();
            win.orientationModes = [Titanium.UI.PORTRAIT];
        }
    });
    
    win.orientationModes = [
        Titanium.UI.LANDSCAPE_LEFT,
        Titanium.UI.LANDSCAPE_RIGHT,
        Titanium.UI.PORTRAIT
    ];
    
    activeMovie.play();
    
    — answered November 2nd 2010 by Ronnie Swietek
    permalink
    1 Comment
    • What mobile SDK? 1.4.1_1, 1.5 nightly?

      — commented November 2nd 2010 by John McKnight
  • I was getting this error when I added a window (win2) to an existing window (win1) and used an event to manipulate win2. The code below will duplicate the error. If you comment out the line that adds win2 to win1, the error disappears and everything works as it should. I am not a Titanium expert and I really don't understand why this happens, but this error appears to be related to how windows are rendered and ordered in the stack.

    If I were to guess what the problem is in your code, I would say that either you are doing something in the finishMovie event that manipulates the activeMovie window or it has something to do with the fullscreen stuff. Try commenting out one of the lines in your 'complete' listener to narrow it down.

    Titanium.UI.setBackgroundColor('#000');
    
    var win1 = Titanium.UI.createWindow({
        backgroundColor:'#000',
        width:320,
        height:380,
        bottom:0
    });
    win1.open();
    
    var win2 = Titanium.UI.createWindow({
        backgroundColor:'#fff',
        width:120,
        height:180,
        bottom:0
    });
    win1.add(win2);  // this is the culprit; comment this out and everything works!!!
    win2.open();
    
    var b1 = Titanium.UI.createButton({
        title:'click me',
        height:40,
        width:200,
        top:50
    });
    win1.add(b1);
    
    var visible = true;
    b1.addEventListener('click', function()
    {
        if (!visible)
        {
            win2.open();
            visible=true;
        }
        else
        {
            win2.close();
            visible=false;
        }
    });
    
    — answered November 9th 2010 by David Knell
    permalink
    0 Comments
  • This is a bug in official 1.4.1.1 and 1.4.2. You have to use the version from http://builds.appcelerator.com.s3.amazonaws.com/index.html

    — answered November 13th 2010 by Konstantin Filtschew
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.