I'd guess that you are not actively engaging with the lecture. Passively sitting in a lecture is just asking for sleep just like counting sheep. You need to take notes. Ignore that the slides are online. Think about how to organize your notes as you write them. Think about headings and subheadings and lists. That task alone will keep you awake and more focused. I also spent my lectures sitting there and imagining what questions I would put on the exam if I were the teacher. Then if couldn't answer the questions I came up with based on what I had heard I would ask the teacher. It also helps if you do the course reading in advance so you have a pre-existing framework for all of the knowledge that the teacher is dumping on you to fall into. It makes it easier and more rewarding to listen because you will feel smart and who wouldn't stay awake for that?