소스 검색

add 'playsinline' to all inline videos, dont mute background videos on mobile

Hakim El Hattab 5 년 전
부모
커밋
2fccb77405
4개의 변경된 파일11개의 추가작업 그리고 6개의 파일을 삭제
  1. 0 0
      dist/reveal.esm.js
  2. 0 0
      dist/reveal.js
  3. 5 1
      examples/media.html
  4. 6 5
      js/controllers/slidecontent.js

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/reveal.esm.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/reveal.js


+ 5 - 1
examples/media.html

@@ -33,7 +33,11 @@
 
 				<section>
 					<h2>Video</h2>
-					<video src="https://static.slid.es/site/homepage/v1/homepage-video-editor.mp4" data-autoplay></video>
+					<video src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" data-autoplay></video>
+				</section>
+
+				<section data-background-video="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" data-background-video-muted>
+					<h2>Background Video</h2>
 				</section>
 
 				<section>

+ 6 - 5
js/controllers/slidecontent.js

@@ -70,6 +70,11 @@ export default class SlideContent {
 				sources += 1;
 			} );
 
+			// Enable inline video playback in mobile Safari
+			if( isMobile && media.tagName === 'VIDEO' ) {
+				media.setAttribute( 'playsinline', '' );
+			}
+
 			// If we rewrote sources for this video/audio element, we need
 			// to manually tell it to load from its new origin
 			if( sources > 0 ) {
@@ -111,12 +116,8 @@ export default class SlideContent {
 						video.muted = true;
 					}
 
-					// Inline video playback works (at least in Mobile Safari) as
-					// long as the video is muted and the `playsinline` attribute is
-					// present
+					// Enable inline playback in mobile Safari
 					if( isMobile ) {
-						video.muted = true;
-						video.autoplay = true;
 						video.setAttribute( 'playsinline', '' );
 					}
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.