How to interact with a police officer(s)

I am so sick of the media acting like cops are just shooting innocent people. As a young man I was always told to do what the officer asks, be respectful and keep your hands on the wheel. I disobeyed that one time and got out of the car to continue to argue my point. The officer got behind his door, put his hand on his gun and proceeded to scream at me to get back in the car. This was a white kid in white suburbia. If I would have escalated this and charged the cop, reached for a weapon, or ran, I am almost certain I would of been shot.
This is not about race as much as it is following the law, respecting authority, and taking accountability for your actions. Everyone of these criminals shot have done the exact opposite. It doesn’t matter what race they are, if people choose to respond to authority in that matter, there chance of being killed escalates. I really hate getting political on a forum meant for enthusiasts, but felt compelled to respond.