Skip to content

Conversation

@jbzdak
Copy link
Contributor

@jbzdak jbzdak commented Apr 4, 2016

This is a follow up on: #114 and #112.

Course set up

What you need is a course where on a step you have a video, and then you can to the next step (you should still hear the video on that next step --- which is the error).

  1. Create a course with three sections, each containing a single subsection and a single unit.

  2. First unit contains following steps:

    a. A step with Video Block and a question
    b. A step with HTML Block with a youtube video and a question. Example embedding code: <iframe width="420" height="315" src="https://www.youtube.com/embed/QH2-TGUlwu4" frameborder="0" allowfullscreen></iframe>
    c. A step with a question (no videos!)
    d. A review step with a HTML with a youtube video, and other review elements.

  3. Second unit contains

    a. A step with OOyala video and a question (OOyala set-up is described in the OC-1441 issue)
    b. A step with a question
    c. A review step

  4. Third unit contains (note that having the same Ooyala video on a two steps in single unit might not work.

    a. A step with a question
    a. A review step with a HTML block with ooyala video embedded.

Verification instructions

  1. Please note that OOyala video needs to be manually started by pasting a snippet to a javascript console --- snippet is attached above the video, and looks like that: OO.ready(function() { OO.Player.create('xxx', 'yyy_zzz'); });. After you start the video it should work as it was started "normally" so tests are still valid.
  2. Go to the block with video, start the video and wait until it loads, fill in the quiz and go to next step. Note that you still hear video music in the background.
  3. Check the same with the OOyala video subsection.
  4. Note that on re-entering the ooyala videos on review step the video doesn't display itself, this is due to the fact that html of review elements is replaced when displaying this step (this is current behaviour in master), which doesn't play well with ooyala .

Testing instructions

For each of the units:

  1. Checkout this branch.

  2. Go to video and block, start the video and wait until it loads, fill in the quiz and go to next step. Note that the video is no longer playing in the background.

  3. Fill in rest of the quiz, watch the review step, and go back to the video step. Verify that video is still working properly.

  4. Check if:

    a. Reloading a page with a video works
    b. Video works on first visit
    c. Video works when re-visiting
    d. Video XBlock rememebers it's position

  5. Note that Ooyala videos in review steps are still broken.

}

var activeStep = $('.mentoring', element).data('active-step');
var activeStepIndex = $('.mentoring', element).data('active-step');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of the changes in this file are leftover from last PR, I left it in on the basis that this makes the code cleaner. But they can be safely removed.

@jbzdak jbzdak force-pushed the jbzdak/oc-1441/detach-html-elements branch from af3c0e7 to 6d9fae4 Compare April 5, 2016 09:15
@@ -0,0 +1,109 @@
(function () {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This can be moved to step.js but I figured that it would be better to have it on separate file, to keep every file simple enough.

Copy link
Member

Choose a reason for hiding this comment

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

@jbzdak Is there a reason not to move the contents of this file to the existing util.js file? If they do need to be kept in a separate file, I think it would make sense to call it step_util.js to indicate the relationship more clearly. (This would also take into account the fact that usage of this file isn't limited to the LMS runtime.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@itsjeyd utils.js is used only in studio (or cms), and this one is used only in lms and while this would have negligible effect on performance, i decided that adding unneeded code would be bad, so I decided to split them.

I'll rename them step_utils.js.

@jbzdak jbzdak force-pushed the jbzdak/oc-1441/detach-html-elements branch from 6d9fae4 to 28bdcbd Compare April 5, 2016 09:52
@jbzdak
Copy link
Contributor Author

jbzdak commented Apr 5, 2016

@itsjeyd This is ready for review.

@jbzdak jbzdak force-pushed the jbzdak/oc-1441/detach-html-elements branch from 7a3f6f7 to c477ea0 Compare April 7, 2016 11:13
/**
* Manager for HTML XBlocks. These blocks are hid by detaching and shown
* by re-attaching them to the DOM.This is only generic way to generically
* handle things like video players (they should stop playing when removed from DOM).
Copy link
Member

Choose a reason for hiding this comment

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

@jbzdak "hid" ⟶ "hidden"

"DOM.This is only generic way to generically handle" ⟶ "DOM. This is the only way to generically handle"

@itsjeyd
Copy link
Member

itsjeyd commented Apr 7, 2016

@jbzdak Reviewed! Please ping me when you're done addressing the comments so I can have another quick look.

@jbzdak jbzdak force-pushed the jbzdak/oc-1441/detach-html-elements branch 3 times, most recently from a26168b to 2af1ddc Compare April 7, 2016 20:13
var submitXHR, resultsXHR,
message = $(element).find('.sb-step-message');

var childManager = new ProblemBuilderUtilLMS.ChildManager(element, runtime);
Copy link
Member

Choose a reason for hiding this comment

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

@jbzdak Now that the utils file has been renamed, ProblemBuilderUtilLMS should be renamed as well I think. How about just StepUtil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I went for ProblemBuilderStepUtil this is a global name attached to window object, so I'd rather be verbose than have a clash.

@jbzdak jbzdak force-pushed the jbzdak/oc-1441/detach-html-elements branch from 8fa4281 to 4b7b231 Compare April 7, 2016 20:34
@itsjeyd
Copy link
Member

itsjeyd commented Apr 7, 2016

@jbzdak 👍 once the build is green and @bradenmacdonald confirms that we can go ahead without adding integration tests for now.

@bradenmacdonald
Copy link
Member

@jbzdak As long as your code is well commented (looks like it is - thanks!), writing integration tests would require enormous effort (which seems to be the case), and all the other non-video-specific refactoring you've done is covered by tests, that's fine with me in this case.

The only thing I would suggest is that you first have a look to see if you can use XBlock.register_temp_plugin to temporarily register a mock HTML or Video XBlock which offers a JS pause method, then do an acceptance test with that, to make sure that the pause method is being called. But again if you look into that and it's going to be an enormous amount of work, we can go without. Then we can revisit testing when we implement first-class support for ooyala blocks.

@jbzdak
Copy link
Contributor Author

jbzdak commented Apr 8, 2016

@bradenmacdonald

Using XBlock.register_temp_plugin would work, if not for this. JQuery-xblock doesnt return Html XModules as children of the step (this runtime is used on Apros), so I added a workaround of querying dom for HTML modules. . . and this workaround would not work in XBlock sdk as the dom elements generated by sdk and lms are different.

In LMS I can select html xblock using div.xblock[data-module-type="html"] and in SDK I'd have to use div.xblock-v1[data-module-type="html"], of course I could add some more or less ugly hack, to make it work. But I'd suggest rather pushing for inclusion of Ooyala block as a first class citizen, and then removing the "detach html nodes from DOM" logic.

@bradenmacdonald
Copy link
Member

@jbzdak Sounds good, let's push for that.

@jbzdak
Copy link
Contributor Author

jbzdak commented Apr 11, 2016

Merging.

@jbzdak jbzdak merged commit 313837a into master Apr 11, 2016
@jbzdak jbzdak deleted the jbzdak/oc-1441/detach-html-elements branch April 11, 2016 16:40
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.

4 participants