We used to pray while animals passed in front of us. We mentioned this to the Messenger of Allah ﷺ, and he said, "Something the size of the back of a saddle placed in front of one of you is enough, and then whatever passes in front of him will not harm him."Ibn Numayr's version says, "Then whoever passes in front of him will not harm him."
و حدثنا محمد بن عبد الله بن نمير وإسحق بن إبراهيم قال إسحق أخبرنا وقال ابن نمير حدثنا عمر بن عبيد الطنافسي عن سماك بن حرب
كنا نصلي والدواب تمر بين أيدينا فذكرنا ذلك لرسول الله ﷺ فقال مثل مؤخرة الرحل تكون بين يدي أحدكم ثم لا يضره ما مر بين يديه و قال ابن نمير فلا يضره من مر بين يديه