Need to resolve "Uncaught type errors" using $(document).ready?

Hey everyone,
The following errors prevent my web app from working:

"Uncaught TypeError: Cannot call method 'removeAttribute' of null"
"Uncaught TypeError: Cannot call method 'appendChild' of null" 

Here’s an example:

The app should play the video playlist as soon as it’s loaded, instead the video just hangs.
The playlist will play if you click on the second video and then click back on the first video.

I get the same error regardless if I place

<script type="text/javascript" src="js/playlist_jquery.js"></script>

between the HEAD tags or right before the closing BODY tag

Some people have suggested to

start playing the video once body is loaded
or put your code inside an onload event.

$(document).ready(function() {
   // start video streaming once all resources are done loading

All of the code that executes the video and the video playlist is from PHP,
so what exactly should I put in the document.ready or onload event?

(I can post the html and php if necessary)

Thanks in advance -

things video may not be loaded completely or enough to start playing until for a while after the document loads.
see if there is any way to detect the video load complete event.

In case anyone is interested I was able to resolve my issue.
I overlooked a setting in the SublimeVideo player. The videos now autoplay.