diff --git a/.gitignore b/.gitignore index 08db758..ea23cc4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ /node_modules /npm-debug.log /*.tgz + +# Files for editors and other tools +/.brackets.json diff --git a/build.js b/build.js index 2aacc4b..7fa47c1 100644 --- a/build.js +++ b/build.js @@ -17,6 +17,7 @@ buildify() 'src/plugins/goto/goto.js', 'src/plugins/help/help.js', 'src/plugins/impressConsole/impressConsole.js', + 'src/plugins/media/media.js', 'src/plugins/mobile/mobile.js', 'src/plugins/mouse-timeout/mouse-timeout.js', 'src/plugins/navigation/navigation.js', diff --git a/js/impress.js b/js/impress.js index f2131ef..db10001 100644 --- a/js/impress.js +++ b/js/impress.js @@ -2510,7 +2510,7 @@ //Btw, you can also launch console automatically: //
if ( root.dataset.consoleAutolaunch === 'true' ) { - window.open(); + open(); } }; @@ -2706,6 +2706,255 @@ } )( document, window ); +/** + * Media Plugin + * + * This plugin will do the following things: + * + * - Add a special class when playing (body.impress-media-video-playing + * and body.impress-media-video-playing) and pausing media (body.impress-media-video-paused + * and body.impress-media-audio-paused) (removing them when ending). + * This can be useful for example for darkening the background or fading out other elements + * while a video is playing. + * Only media at the current step are taken into account. All classes are removed when leaving + * a step. + * + * - Introduce the following new data attributes: + * + * - data-media-autoplay="true": Autostart media when entering its step. + * - data-media-autostop="true": Stop media (= pause and reset to start), when leaving its + * step. + * - data-media-autopause="true": Pause media but keep current time when leaving its step. + * + * When these attributes are added to a step they are inherited by all media on this step. + * Of course this setting can be overwritten by adding different attributes to inidvidual + * media. + * + * The same rule applies when this attributes is added to the root element. Settings can be + * overwritten for individual steps and media. + * + * Examples: + * - data-media-autostart="true" data-media-autostop="true": start media on enter, stop on + * leave, restart from beginning when re-entering the step. + * + * - data-media-autostart="true" data-media-autopause="true": start media on enter, pause on + * leave, resume on re-enter + * + * - data-media-autostart="true" data-media-autostop="true" data-media-autopause="true": start + * media on enter, stop on leave (stop overwrites pause). + * + * - data-media-autostart="true" data-media-autopause="false": let media start automatically + * when entering a step and let it play when leaving the step. + * + * -
...
+ * All media is startet automatically on all steps except the one that has the + * data-media-autostart="false" attribute. + * + * - Pro tip: Use