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.js41
1 files changed, 40 insertions, 1 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 1c5cec91..9670e0c4 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -838,6 +838,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
838 this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0); 838 this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0);
839 this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0); 839 this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0);
840 this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start 840 this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start
841
842 //pause videos on switching or closing the document, so that the browser does not keep downloading the media data
843 this.pauseVideos();
841 } 844 }
842 }, 845 },
843 846
@@ -866,6 +869,42 @@ exports.HTMLDocument = Montage.create(TextDocument, {
866 869
867 870
868 } 871 }
869 } 872 },
870 //////////////////////////////////////////////////////////////////// 873 ////////////////////////////////////////////////////////////////////
874 /**
875 *pause videos on switching or closing the document, so that the browser does not keep downloading the media data
876 *removeSrc : boolean to remove the src if the video... set only in the close document flow
877 */
878 pauseVideos:{
879 value:function(removeSrc){
880 //console.log("$$$ pauseVideos");
881 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0;
882 for(i=0;i<videosArr.length;i++){
883 if(!videosArr[i].paused){
884 videosArr[i].pause();
885 }
886 //console.log("$$$ Paused ", videosArr[i]);
887 if((typeof removeSrc !== "undefined") && (removeSrc === true)){
888 videosArr[i].src = "";
889 //console.log("$$$ stopped ");
890 }
891 }
892 }
893 },
894
895 /**
896 * remove the video src on closing the document, so that the browser does not keep downloading the media data, if the tag does not get garbage collected
897 *removeSrc : boolean to remove the src if the video... set only in the close document flow
898 */
899 stopVideos:{
900 value:function(){
901 //console.log("$$$ stopVideos");
902 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0;
903 for(i=0;i<videosArr.length;i++){
904 videosArr[i].src = "";
905 //console.log("$$$ stopped ", videosArr[i]);
906 }
907 }
908 }
909 ////////////////////////////////////////////////////////////////////
871}); \ No newline at end of file 910}); \ No newline at end of file