Its very difficult for me because on the picture he really looks like he is just a healthy looking betta. I don't see pop eye, bloating, nothing visual on the body.
If he getting better continue Maracyn but do not use longer than recommendation on the box.
The slimy stuff i am thinking can be his slime coat because its coming on and off, and its all over in the tank. I would think if its would be a fungus it will be directly only on him, not in the tank.
Pictures fish with fungus
What confusing me that you said all those symptoms:darting, flashing, rubbing those symptoms usually for external parasites or internal parasites
Then you wrote that he having problems swimming straight. every time he swims down his body turns him every which way and he cant go straight so instead of going down his body flips him and he goes up... THIS SOUND LIKE SWIM BLADDER problems.
So i think he has a few issues going on. And you saying that his poo back to normal but it was whitish meaning that something going on internally . So try to monitor his poo . If there nothing in the tank its will be easier for you to do it.
Check the pictures , i don't think he has it? Because if he don't have fungus i would try to increase the temp just in case its ich. If he still rubbing and darting , and flashing i really think he might has some parasites.
Also meanwhile do daily water changes ,even though you are using med's. Just redose the new water with required dose of the meds for the day.
Try to feed him because he need strength to fight what ever he has. I would really recommend to go to the store and but frozen blood worms. If he is eating though. Frozen food has a lot of protein and will help the immune system.
If you can order kanaplex it good to have it on hands anyway if you going to have a betta in your life. Its treats both ext and internal infection.
Maracyn II also the only one antibiotic that absorb through the skin/gills and reach internal infection. But i am not sure if its works in high pH. But since he started eating i would continue it.
When is last treatment for the Maracyn?
Its good that you saying you have Epsom salt its also helps with internal infection . So see how he doing with meds may you will need to use Epsom later.
I am sorry for my disorganized post , i am at work with many people coming to the room , and doing a lot of stuff so its kind of difficult to be organized since i am doing personal stuff lol