The forum on this site is closed for new comments and posts. Continue the conversation in our Snap AR Discord server.

Wrong Argument Number Count

  • Hey Jessica,

    I created a private thread and share the fixed project files over there.

    But for anyone who has the same problem, The problem is for the video texture its the best to check the video state before playing the video.

    You can do it like this:

    var provider = script.meme.mainPass.baseTex.control;

    if ( provider.getStatus() != VideoStatus.Playing )

    {

    provider.play( -1 ); // -1 will play looped.

    }
    Hope this will help.
     
    Best,
    Amir.

     

    Comment actions Permalink
  • Hello Jessie,

    Can you replace the way you play your animated texture from what you have to this one and see if you can get it to working:

     

    //@input Component.SpriteVisual spriteVisual
    
    var loops = 100;
    var offset = 0.0;
    
    var provider = script.spriteVisual.mainPass.baseTex.control;
    provider.play(loops, offset);

    In this way all you need to do is to assign your animated texture to the sprite and then assign the sprite to this script.

    Hope this will help you to fix the problem

    Amir.

    Comment actions Permalink
  • Amir - that would be replacing the following script, correct?

     

    // -----JS CODE-----

    // Plays a video texture

    //@input Asset.Texture movie

     

    var loops = 1;

     

    var provider = script.movie.control;

    provider.play(loops);

     

    Also, that script is making me assign a sprite visual (which has to be a sprite object) and a scene object (which also has to be a sprite object). Do I have to assign the same sprite to both? The video is already assigned to the texture of that sprite, by the way. I tried assigning the same script to both spots but it would not run.

    Comment actions Permalink
  • Hey Jessie,

    No that's actually would be a replacing for your play animation code.

    Also can you please share your project file if it didn't help you to fix the problem.

    Best,

    Amir.

    Comment actions Permalink
  • That didn't work but I can share the file - if you can send me an email at ****** I will respond with the file (from when it was still working, but had the error) for you to try to adjust!

    Thanks!

    Comment actions Permalink
  • Hey Jessie,

    I created a private thread that you can send me the file over there.

    You should get an email and we can follow up offline.

    Best,

    Amir.

    Comment actions Permalink
  • Hi Amir, I'm also having a problem with this issue

    When I input my code

    // -----JS CODE-----

    // @input Component.SpriteVisual meme

     

    script.meme.enabled = true

    var provider = script.meme.mainPass.baseTex.control;

    provider.play(1,0);

     

    I also get the error

     

     Error: Wrong argument number count, expected 1, got 2
    at [anon] () native strict preventsyield
    at [anon] (Script:6) preventsyield

    when I change the play(1,0) to play(1) it works when I tap the preview, however it says "calling play from invalid state"

    I'm not sure how I can get the video texture to work with the script because I just want to play a video texture by tapping the screen.

    Thanks

     

    Comment actions Permalink
  • Hey Jessica,

    Your script looks fine but you can check if the file is animated texture then start to play it to avoid the error logs.

    In order to do that update your script to be like below:

    // @input Component.SpriteVisual meme

    if( script.meme )

    {

    script.meme.enabled = true;

    var isAnimated = !!script.meme.mainPass.baseTex.control.getDuration;

    if( isAnimated )

    {

    var provider = script.meme.mainPass.baseTex.control;

    provider.play( 1, 0 );

    }

    }
     
    Hope this will fix your problem.
    Cheers,
    Amir.
    Comment actions Permalink
  • Hi Amir,

    When I inputed that script the log said

     ReferenceError: identifier 'isAnimated' undefined
    at [anon] (Script:11) preventsyield

    I'm not sure what to do from there, 

    sorry for the trouble.

     

    Comment actions Permalink
  • Hey Jessica,

    Can you please share your project file so I can investigate on it?

    Best,

    Amir.

    Comment actions Permalink
  • Hi Amir, 

    I can share the file on google drive 

    https://drive.google.com/open?id=1bBuXcTIJNrpuWvcyMLBd1K2rCT8BUZi5 

    if you copy and paste the link it should work, the hyperlink doesn't work

    Thanks so much!

    Comment actions Permalink
  • Hey,

    Can you please double check the URL?

    Im getting Error 404 (Not Found).

    Best,

    Amir.

    Comment actions Permalink
  • It should work, when I copy and paste the link it loads up.

    If it doesn't work can I send it to you through an email?

    I'll send the link again, maybe it'll work this time

    https://drive.google.com/open?id=1bBuXcTIJNrpuWvcyMLBd1K2rCT8BUZi5 

     

    thanks

    Comment actions Permalink
  • Hey Jessica,

    Yes the link is now working but you need to send me the whole project folder not only the .lsproj file.

     

    Thanks,

    Amir.

    Comment actions Permalink
  • Hi Amir,

    Sorry about that XD as you can tell i'm very new at this. I uploaded the whole folder so it should be there now.

    Thanks!

    Comment actions Permalink
  • Can you please send me the link of the folder?

    Best,

    A.

    Comment actions Permalink
  • Comment actions Permalink
  • Hi Amir, 

    This fixed the problem for me, Thank you so much!!! ^^

    Comment actions Permalink

We're here to help! We just need a little bit of information...

What system are you using?

Have you downloaded the latest version of Lens Studio?

Please download the latest version of Lens Studio. If you still run into this issue, please come back and report it!

Is this issue causing Lens Studio to crash?

What system do you run Lens Studio on?

Version

Graphics

Follow the next steps to help us solve your issue:

  • Copy and paste this text into your TerminalCommand Window
    open ~/Library/Preferences/Snap/Lens\ Studio/ %LOCALAPPDATA%\Snap\Lens Studio Copy Text
  • Press ReturnEnter to run the command. The Lens Studio folder will automatically open
  • Prepare to upload your files: zip the "Log" Folder by right-clicking and choosing "compress."
    Locate the Log.txt file right above it.

    Attach a screenshot of the issue:

Name:

Email:

What is this most relevant to?

Please enter a brief description of your issue:

Thanks for submitting this issue.

Unfortunately, it's likely due to the operating system or hardware you're using – since they don't meet the system requirements for Lens Studio.

Still, we hear you loud and clear, and are logging the issue in case there's ever a workaround we can provide!

Minimum Requirements

Operating System: Windows 10 (64 bit); MacOS 10.11+

Hardware: Minimum of Intel Core i3 2.5Ghz or AMD Phenom II 2.6Ghz with 4 GB RAM; Intel HD Graphics 4000 / Nvidia GeForce 710 / AMD Radeon HD 6450 or better; screen resolution of 1280x768 or higher

We'll try to resolve this issue as soon as possible. Thanks for letting us know about it!

Keep an eye out for a followup email from us. We may have a couple more questions for you, or we might already have a solution to offer.

Happy creating!