I don't understand this if clause.  If the user paused the video right at the end, shouldn't we restore it at the end? 

In any case, this does not seem like the right place to be updating the metadata. That should be handled somewhere else.  
And, I don't think it makes sense to update the local value of the metadata without saving it to mediadb, does it?