In general, yes. You can even do it without a shortcode if you get the appropriate code. On YouTube (from the browser and not one of their mobile apps), if you go to Share > Embed, you’ll get an <iframe> code which you can paste into a text widget and the video will embed into the sidebar.