Skip to content

Commit

Permalink
Remove Modernizr from docs (it no longer works reliably)
Browse files Browse the repository at this point in the history
  • Loading branch information
OriginalEXE committed Aug 24, 2018
1 parent 56e0af2 commit 7e761a5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 50 deletions.
8 changes: 2 additions & 6 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ <h2>Documentation</h2>
autoplay videos. A foolish approach is detecting touch screens, but
not only is it really hard, it's also not precise because a lot of
laptops have touch screens. It is left up to the developer to
implement detection that best suits his project. For this demo, I
am using <a href="https://modernizr.com/download/?videoautoplay">Modernizr</a>
autoplay detection that is really hacky (and quite big), but seems
to work pretty reliably.
implement detection that best suits his project.
</p>
<p>
On devices you don't want to display videos on, I suggest only
Expand Down Expand Up @@ -496,8 +493,7 @@ <h5>buffering</h5>
</div>
</section>

<script type="text/javascript" src="js/modernizr.js"></script>
<script type="text/javascript" src="https://s3-eu-west-1.amazonaws.com/originalexe/vidim/release/1.0.1/vidim.min.js"></script>
<script type="text/javascript" src="https://s3-eu-west-1.amazonaws.com/originalexe/vidim/release/1.0.2/vidim.min.js"></script>
<script type="text/javascript" src="js/demo.js"></script>

</body>
Expand Down
81 changes: 38 additions & 43 deletions docs/js/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,67 +34,62 @@
var youtubeSrc = 'https://www.youtube.com/watch?v=uVW81kp2HSo';

var cover = document.querySelector( '.js-cover' );
var vidimCover = new vidim( cover, {
src: htmlSrc1,
poster: poster1,
overlayClass: 'cover__overlay'
});

Modernizr.on( 'videoautoplay', function( canAutoplay ) {

var vidimCover = new vidim( cover, {
src: canAutoplay ? htmlSrc1 : false,
poster: poster1,
overlayClass: 'cover__overlay'
});

var demo1 = new vidim( '#demo-1', {
src: canAutoplay ? htmlSrc1 : false,
poster: poster1
});

var demo2 = new vidim( '#demo-2', {
src: canAutoplay ? youtubeSrc : false,
type: 'YouTube',
poster: poster1
});
var demo1 = new vidim( '#demo-1', {
src: htmlSrc1,
poster: poster1
});

var demo3 = new vidim( '#demo-3', {
src: htmlSrc1,
poster: poster1
});
var demo2 = new vidim( '#demo-2', {
src: youtubeSrc,
type: 'YouTube',
poster: poster1
});

document.querySelector( '.js-play' )
.addEventListener( 'click', function( e ) {
var demo3 = new vidim( '#demo-3', {
src: htmlSrc1,
poster: poster1
});

e.preventDefault();
document.querySelector( '.js-play' )
.addEventListener( 'click', function( e ) {

demo3.play();
e.preventDefault();

}, false );
demo3.play();

document.querySelector( '.js-pause' )
.addEventListener( 'click', function( e ) {
}, false );

e.preventDefault();
document.querySelector( '.js-pause' )
.addEventListener( 'click', function( e ) {

demo3.pause();
e.preventDefault();

}, false );
demo3.pause();

document.querySelector( '.js-change-source' )
.addEventListener( 'click', function( e ) {
}, false );

e.preventDefault();
document.querySelector( '.js-change-source' )
.addEventListener( 'click', function( e ) {

demo3.changeSource( htmlSrc2, poster2 );
e.preventDefault();

}, false );
demo3.changeSource( htmlSrc2, poster2 );

document.querySelector( '.js-show-poster' )
.addEventListener( 'click', function( e ) {
}, false );

e.preventDefault();
document.querySelector( '.js-show-poster' )
.addEventListener( 'click', function( e ) {

demo3.showPoster();
e.preventDefault();

}, false );
demo3.showPoster();

});
}, false );

})();
1 change: 0 additions & 1 deletion docs/js/modernizr.js

This file was deleted.

0 comments on commit 7e761a5

Please sign in to comment.