Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] video files crash

edited June 2015 in OpenSesame

Hi all,

I'm doing an experiment in which I should show participants a series of short videos (2 seconds each).
Participants have to respond pressing one button on the keyboard before the video end. The problem is that if the response is too fast (something like < 1 sec) the experiment crashes.
I've tried both with including the videos in the file pool or referring to them by name.

Is there anything that I can do?

Thanks in advance,

Andrea

Comments

  • edited 4:27AM

    Hi Andrea,

    I'm assuming it works correctly if people respond after that first second? What does the pop-up window say when it crashes?
    And another thing: do people have to be allowed to respond this fast in the first place? If not, then you could also design the experiment in such a way that there is no response possible until after the first second.

    Cheers,

    Josh

  • edited 4:27AM

    Hi Josh,

    Yes, it works correctly if participants respond after the first second! There is no pop-up window, it just stops and doesn't go on....
    Theoretically they could respond at any time, even if I think that in this specific case a response faster than 1 second makes no sense....
    I can design the experiment in such that the response is possible only after the end of the video but I'm afraid that in this way I'll lose a lot of informations... How can I design it to allow response only after the first second of the video (since that every video last 2 seconds)?

    Thanks,

    Andrea

  • edited May 2015

    Hi Andrea,

    Right before the video item, you could place an inline_script where you create a variable that keeps track of time. Normally, this would be as simple as: start_time = self.time(), whereby self.time() is a command that returns the time to a variable called "start_time".

    Now in the video item (do you use media_player_vlc?), there is a window where you can put optional code; this is where you could insert: current_time = self.time() - start_time. Hence, if this code is called 800ms after the inline_script, current_time would be assigned the value 800. We can use this as a means to keep track of time. Be sure to set the "call custom python code" option to "after every frame", so you are indeed continuously keeping track of time.
    The code window would look something like this:

       from openexp.keyboard import keyboard
       my_keyboard = keyboard(exp)
       response, time = my_keyboard.get_key() # collects a key response (or 'none' in  
                                                                          case  nothing was pressed)
    
       current_time = self.time() - start_time
       if current_time > 999 and response != 'none': # i.e., if there was a response
              From here, anything you want to do after your response.
    

    Lastly, the variable start_time you created in your inline_script needs one more thing. If you create a variable like that, it's only 'known' in your inline_scripts, but not yet in other types of items in your experiment (such as your video item). In order to take care of this, you have to add: exp.set('start_time', start_time) after the previous command.
    Now the variable can be called upon anywhere in your experiment. In the video item, you have to insert: start_time = exp.get('start_time'); or simply write current_time = self.time() - exp.get('start_time') directly.

    Let me know how it goes.

    Cheers,

    Josh

  • edited 4:27AM

    Hi Josh!

    First of all, sorry for the very late reply!!!
    I've tried your suggestion and it works! Now the experiment doesn't crash anymore!

    Thank you so much!

    Cheers,
    Andrea

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games