ctreffe / alfred

Alfred - A library for rapid experiment development
MIT License
10 stars 1 forks source link

Very long loading times when using a video on a Page #145

Open mate-code opened 2 years ago

mate-code commented 2 years ago

I use a video on one of my pages (1080p, 2:42, 156 MB) and every time I klick on the "Next" button, I get up to 10 seconds waiting times. I was wondering if anybody else can reproduce this issue or is it doe to running the experiment locally?

jobrachem commented 2 years ago

Hi Marius, thanks for pointing out the issue! Would you provide us with a minimal example and, ideally, the video file for reproduction?

mate-code commented 2 years ago

Minimum example:

import alfred3 as al

exp = al.Experiment()

@exp.member(of_section="main")
class VideoPage(al.WidePage):

    def on_first_show(self):
        gender = self.exp.values.get("gender")
        self.exp.randomizer = al.ListRandomizer(
            ("video_male", 60), ("video_female", 60), name=gender, exp=self.exp
        )
        self.exp.condition = self.exp.randomizer.get_condition()

    def on_exp_access(self):
        condition = self.exp.condition
        video = "male" if condition == "video_male" else "female"
        p = self
        p += al.Video(
            path=f"media/condition-{video}-1080p.mp4",
            allow_fullscreen=True,
            autoplay=True,
            controls=False,
            loop=False,
        )

I'll send you the video privately, as some of the actors do not want the video publicly posted

jobrachem commented 8 months ago

It is probably best to upload videos to Youtube or a similar service and then embed them with an html element. We give this issue low priority for the time being.