HTML5 Video - Load and unload video tag with jQuery -


I am developing a website with a large slider which uses 100% width and height slides. I am using some video as background in some video slides. When I tried several plugins, some were working with JScroll, so I ended up using the "plain video jquery plugin" ().

The plugin uses video tags to play everything I am also adding a video tag inside each page, such as:

  & lt; Div class = "rsImg page" id = "page1" & gt; & Lt; Video poster = "video / poster page" id = "video-intro" & gt; & Lt; Source src = "video / trailer_480p.ogg" type = "video / og" & gt; & Lt; Source src = "video / video.mp34" type = "video / mp34" & gt; & Lt; / Video & gt; & Lt; / Div & gt; & Lt ;! - End of page 1 - & gt;   

The video plays and behaves correctly, it's good.

But as I add more slides, I am concerned about memory usage and slow speed in the whole experience. / P>

I have a function that listens for the "slide change" event, so there will be no problem deleting the video while changing the slide, such as:

  POSCLIDER .ev.on ('rsAfterSlideChange', function) (if (poshSlider.currSlideId + 1! = 1) {$ ('# video-intro'). Trigger ('stop'); $ ('video') below () .remove ();} Other {$ ('# Page1'). App ('& lt; video poster = "video / poster page" id = "video-intro">  ); $ ('# video-intro') .simpleVideo (); $ ('# Video-intro'). Trigger ('Play');}});   

So I have tried to clear and remove the empty divas, and after this, after that, to start the video again, I want to add the same code in one place. Thought, but it does not work as expected and I do not know that this is a good way to take care of the memory leak.

Edit:

I was using the "append" "html". My code now works like this, I need to increase memory and some kind of garbage collection. any advice?

  posselelder.ev.on ('rsfstarslide change', function () (if (poschldlercurraslidid + 1! = 1) {$ ('# video-intro'). Trigger ('stop' ); $ ('Video') empty (). Remove ();} and {$ ('# page1') .HTML ('& lt; video poster = "video / poster page" id = "video-intro" & Gt; source src = "video / trailer_480 p.ogg" type = "video / og" & gt; & lt; source src = "video / video.mp4" type = "video / mp3"> gt; & lt ; / Video & gt; '); $ (' # Video-intro '). SimpleVideo (); $ (' # VideoP Trigger ('Play');}});    

To reset the blank without removing

  $ ("# Video-intro"). First (). Attr ('src', '')   < P> This stops the video and I believe it saves memory   

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -