You appear to be having some kind of eyelid infection
. Frothy discharge is a sign of meibomianitis, which is inflammation of the meibomian glands. Black spots in front of the eye are floaters
they may be fixed or moving. Persistent black spots in the field of vision are worrisome. You should get an eye checkup and retinal examination for the well being of your eyes.