1. When he was playing the piano, his brother came in.

2. He playing the piano, his brother came in.
--------------------------------------
3. While he was walking along the river, he was listening to music.

4. Walking along the river, he was listening to music.
--------------------------------------
5. When he was driving a car, a person fell on to the street.

6. He driving a car, a person fell onto the street.
---------------------------------------
7. When he was riding a bike, he saw Jack.

8. Riding a bike, he saw Jack.
=====================================
Are the four pairs all grammatical and interchangable?

1 is fine; 2 is incorrect/ungrammatical.

3 and 4 are fine.

5 is fine; 6 is incorrect.

7 is fine; 8 is okay.