Hi She,
What you mean by "play in background" ?
If you want just to hide the video you can use following JS code instead of yours:
precode
var video = jQuery('<video autoplay loop poster="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/polina.jpg">id="bgvid" loop<source src="//demosthenes.info/assets/videos/polina.webm" type="video/webm" /> <source src="//demosthenes.info/assets/videos/polina.mp4" type="video/mp4" /></video>');
$('div[dsid="mobilecontainer"]').append(video );
jQuery("video").css({width: "1px", height: "1px"});
/code/pre
Regards.