Skip to content
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

Merged
merged 2 commits into from
Jan 3, 2017

Conversation

sendr
Copy link

@sendr sendr commented Jan 3, 2017

No description provided.

@@ -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();
Copy link

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
Copy link

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': '';
Copy link

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(
Copy link

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;
Copy link

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';
Copy link

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;
Copy link

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?

Copy link

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.

Copy link

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?

Copy link

@z4y4ts z4y4ts Jan 3, 2017

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" }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transcriptsEnabled to be consistent

@sendr sendr force-pushed the feature/interactive_transcripts_display branch from 10d3acb to 8de712f Compare January 3, 2017 17:36
@sendr sendr merged commit 6af5f50 into dev Jan 3, 2017
@sendr sendr deleted the feature/interactive_transcripts_display branch February 24, 2017 15:29
dyudyunov pushed a commit that referenced this pull request Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants