Involved in the initial and rate-limiting step of peroxisomal beta-oxidation of straight-chain saturated and unsaturated very-long-chain fatty acids. Catalyzes the desaturation of fatty acyl-CoAs such as palmitoyl-CoA (hexadecanoyl-CoA) to 2-trans-enoyl-CoAs ((2E)-enoyl-CoAs) such as (2E)-hexadecenoyl-CoA, and donates electrons directly to molecular oxygen (O2), thereby producing hydrogen peroxide (H2O2).