A problem arises when using three-angle sequences and particular values of the middle angle leads to a condition called a singularity. This mathematical phenomena is related to a problem that occurs in the physical world with mechanical gimbal systems.
Note that in Robotics, Vision & Control (second edition) and RTB10.x the default definition of roll-pitch-yaw angles has changed from Rx.Ry.Rz to Rz.Ry.Rx. To obtain the same results as shown at 00:22 with RTB10.x use
>> rpy2r(0.3, pi/2, 0.5, 'xyz')
>> tr2rpy(ans, 'xyz')