Article: Defensive Driving Rule #35: Never Play Chicken With a Train
Don't ever, ever let your vehicle come to a stop on a railroad track. Let the other vehicles clear out beyond the tracks before you move over the tracks.
I worked for a railroad company and I know what can happen. The train CANNOT stop and the car or truck or whatever always loses the confrontation and whoever is inside nearly always dies.
Watch for the gate that swings down and don't go past it until after there is sufficient room ahead to completely clear all the tracks. If you don't do this, you are toying with death.