If the only contact allowed is your feet on the pedals, I do not think it is possible to balance for any sustained amount of time. It only becomes possible when you allow a third point of contact to leverage against, such as a thigh against the top tube. This is because the pedals are offset somewhat from the center of the bike, so you will not be able to use them without falling over if those are the only points you are in contact with.
Only touching the pedals, if you try to push down on one pedal, the whole bike will go in that direction, and quickly fall over. There needs to be another point of contact in order to have forward motion. If you are holding still/doing a track stand, you control your side-to-side motion by holding the wheel at a ~45 degree angle and manipulating your forward-backwards motion as necessary. If you can't redistribute your weight on the pedals to go forwards/backwards slightly without falling over, you will not be able to do a track stand.
If the bike is already moving and you have really good balance, you might be able to stand up for a second only on the pedals, but any need for corrective balancing will require at least one more point of contact.