You have to initialize the dialog before being able to open it:
$(function() {
$("#dialog").dialog({
autoOpen: false
});
$("#player").on('click', 'img', function() {
...
Here's a complete example: https://jqueryui.com/dialog/#animated