Skip to content

Commit 4a3aff7

Browse files
committed
adding ogv, and mute button
1 parent 8129b8d commit 4a3aff7

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

dist/react-drive-in.js

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-drive-in.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/glacier.ogv

5.77 MB
Binary file not shown.

example/index.html

+11-1
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@
6464
<button onClick="itemSelect(3);">Item #3</button>
6565
</div>
6666

67-
<div class="play-toggle buttons">
67+
<div class="toggle buttons">
6868
<button onClick="playToggle();">Play / Pause</button>
69+
<button onClick="muteToggle();">Mute / Unmute</button>
6970
</div>
7071

7172
<div class="car">
@@ -121,6 +122,14 @@ <h2>Currently Playing: <span id="currItem"></span></h2>
121122
}
122123
}
123124

125+
function muteToggle() {
126+
if (driveIn.state.mute) {
127+
driveIn.unmute();
128+
} else {
129+
driveIn.mute();
130+
}
131+
}
132+
124133
var playlist = [
125134
[
126135
'http://dfcb.github.io/BigVideo.js/vids/river.mp4',
@@ -134,6 +143,7 @@ <h2>Currently Playing: <span id="currItem"></span></h2>
134143
],
135144
[
136145
'http://raw.githubusercontent.com/ronik-design/react-drive-in/master/example/glacier.mp4',
146+
'http://raw.githubusercontent.com/ronik-design/react-drive-in/master/example/glacier.ogv',
137147
'http://raw.githubusercontent.com/ronik-design/react-drive-in/master/example/glacier.jpg'
138148
]
139149
];

lib/drive-in.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -565,15 +565,16 @@ DriveIn.prototype.showPlaylist = function(rawPlaylist, options) {
565565
};
566566

567567
DriveIn.prototype.setVolume = function(level) {
568-
569568
if (this.currMediaType === 'image') {
570569
return;
571570
}
572571

573572
if (level === 0) {
573+
this.mute = true;
574574
this.mediaEl.muted = true;
575575
this.mediaEl.volume = 0;
576576
} else {
577+
this.mute = false;
577578
this.mediaEl.muted = false;
578579
this.mediaEl.volume = level;
579580
}

lib/react-drive-in.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,12 @@ module.exports = React.createClass({
113113

114114
mute() {
115115
this.DI.setVolume(0);
116+
this.state.mute = true;
116117
},
117118

118119
unmute() {
119120
this.DI.setVolume(this.props.volume);
121+
this.state.mute = false;
120122
},
121123

122124
renderMedia() {

0 commit comments

Comments
 (0)