-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabling/disabling of interactive transcripts #47
Conversation
@@ -38,7 +38,7 @@ domReady(function() { | |||
var el = event.currentTarget; | |||
el.classList.toggle('vjs-control-enabled'); | |||
var _event = this.hasClass('vjs-control-enabled') ? this.enabledEventName() : this.disabledEventName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename _event -> eventName
To avoid confusion.
}); | ||
|
||
// attach the widget to the page | ||
var transcriptContainer = document.getElementById('transcript'); | ||
transcriptContainer.appendChild(transcript.el()); | ||
|
||
// Show or hide the transcripts block in depend of the transcript state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in depend of -> depending on
this.toggleButton({ | ||
style: "fa-cc", | ||
enabledEvent: "captionenabled", | ||
disabledEvent: "captiondisabled", | ||
cssClasses: "vjs-custom-caption-button vjs-control", | ||
}); | ||
var cssClasses = "vjs-custom-transcript-button vjs-control"; | ||
this.transcriptEnabled ? cssClasses += ' vjs-control-enabled': ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ternary operator. Your using it semantically wrong here.
Rewrite with if (...) {...}
@@ -116,6 +116,12 @@ class VideoXBlock(StudioEditableXBlockMixin, XBlock): | |||
help=_("Video muted or not") | |||
) | |||
|
|||
transcript_enabled = Boolean( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transcripts_enabled
to be consistent with transcripts
field.
Also there may be more that one transcript.
@@ -45,7 +46,8 @@ var setInitialState = function (player, state) { | |||
player | |||
.volume(state.volume) | |||
.muted(state.muted) | |||
.playbackRate(state.playbackRate); | |||
.playbackRate(state.playbackRate) | |||
.transcriptEnabled = state.transcriptEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use chaining here
}); | ||
|
||
// attach the widget to the page | ||
var transcriptContainer = document.getElementById('transcript'); | ||
transcriptContainer.appendChild(transcript.el()); | ||
|
||
// Show or hide the transcripts block in depend of the transcript state | ||
transcriptContainer.style.display = this.transcriptEnabled ? 'block' : 'none'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use classNames + css to show/hide element
@@ -1,5 +1,6 @@ | |||
body { | |||
margin: 0; | |||
display: flex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need flex here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make video container shrink when side-transcripts are displayed, I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we need to set flex
rule on a child node?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solution was suggested by @madeira and is working. Setting display: flex;
on a video container doesn't work as far as I can see.
@@ -24,6 +24,7 @@ var player_state = { | |||
'currentTime': {{ player_state.current_time }}, | |||
'playbackRate': {{ player_state.playback_rate }}, | |||
'muted': {{ player_state.muted | yesno:"true,false" }}, | |||
'transcriptEnabled': {{ player_state.transcript_enabled | yesno:"true,false" }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transcriptsEnabled
to be consistent
…e/interactive_transcripts_display Fix conflicts
10d3acb
to
8de712f
Compare
No description provided.