aboutsummaryrefslogtreecommitdiff
path: root/js/document/html-document.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/document/html-document.js')
-rwxr-xr-xjs/document/html-document.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 83f91c19..f730b853 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -872,22 +872,15 @@ exports.HTMLDocument = Montage.create(TextDocument, {
872 }, 872 },
873 //////////////////////////////////////////////////////////////////// 873 ////////////////////////////////////////////////////////////////////
874 /** 874 /**
875 *pause videos on switching or closing the document, so that the browser does not keep downloading the media data 875 *pause videos on switching or closing the document
876 *removeSrc : boolean to remove the src if the video... set only in the close document flow
877 */ 876 */
878 pauseVideos:{ 877 pauseVideos:{
879 value:function(removeSrc){ 878 value:function(){
880 //console.log("$$$ pauseVideos");
881 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; 879 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0;
882 for(i=0;i<videosArr.length;i++){ 880 for(i=0;i<videosArr.length;i++){
883 if(!videosArr[i].paused){ 881 if(!videosArr[i].paused){
884 videosArr[i].pause(); 882 videosArr[i].pause();
885 } 883 }
886 //console.log("$$$ Paused ", videosArr[i]);
887 if((typeof removeSrc !== "undefined") && (removeSrc === true)){
888 videosArr[i].src = "";
889 //console.log("$$$ stopped ");
890 }
891 } 884 }
892 } 885 }
893 }, 886 },
@@ -897,11 +890,21 @@ exports.HTMLDocument = Montage.create(TextDocument, {
897 */ 890 */
898 stopVideos:{ 891 stopVideos:{
899 value:function(){ 892 value:function(){
900 //console.log("$$$ stopVideos");
901 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; 893 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0;
902 for(i=0;i<videosArr.length;i++){ 894 for(i=0;i<videosArr.length;i++){
903 videosArr[i].src = ""; 895 videosArr[i].src = "";
904 //console.log("$$$ stopped ", videosArr[i]); 896 }
897 }
898 },
899
900 pauseAndStopVideos:{
901 value:function(){
902 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0;
903 for(i=0;i<videosArr.length;i++){
904 if(!videosArr[i].paused){
905 videosArr[i].pause();
906 }
907 videosArr[i].src = "";
905 } 908 }
906 } 909 }
907 } 910 }