javascript - brightcove not showing when rendered (not page refresh - plain Backbone.js View re-render) -


tldr; video player doesn't show on re-render (backbone view)

is there global state brightcove keeps?

i'm using backbone.js , rendering page using backbone view jst.ejs template. works first time around. if navigate next page , back, doesn't show anymore.

<script language="javascript" type="text/javascript" src="http://admin.brightcove.com/js/brightcoveexperiences.js"></script> <script>   window.bcvideo = bcvideofunction(); //bcvideofunction module pattern. </script>  <object id="bc_experience" class="brightcoveexperience">   <param name="includeapi" value="true" />   <param name="templateloadhandler" value="bcvideo.ontemplateload" />   <param name="templatereadyhandler" value="bcvideo.ontemplateready" />   <param name="bgcolor" value="#ffffff" />   <param name="width" value="100%" />   <param name="height" value="100%" />   <param name="playerid" value="1426444499001" />   <param name="playerkey" value="aq~~,aaabtahetae~,g1rkcv5og48msi78dncnab9meyskui_b" />   <param name="isvid" value="true" />   <param name="isui" value="true" />   <param name="wmode" value="transparent"/>   <param name="dynamicstreaming" value="true" />   <param name="wmode" value="transparent"/>   <param name="@videoplayer" value="<%= variables.video_id %>" /> </object> 

after rerender (second visit), can see object exists

 > window.bc_experience  `      <object type=​"application/​x-shockwave-flash" data=​"http:​/​/​c.brightcove.com ...  # window.bc_experience.remove() doesn't 

removing dom doesn't help. yeah... helping !

you should avoid using <script> tags inside template. external script should outside of template , can replace following:

<script>   window.bcvideo = bcvideofunction(); //bcvideofunction module pattern. </script> 

with:

<% window.bcvideo = bcvideofunction(); %> 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -