Skip to content

Possible to expose H5P.Video instance? #6

@sdcloudt

Description

@sdcloudt

Hi,
I am working on a private H5P library based on H5P.Question. For this custom question I would like to add some interactivity to it, for example play a certain part of the video on a wrong answer, and another part for a correct answer. For my custom question this could be extended to specific feedback on specific mistakes. To do this I need to control the video instance which is unfortenately private in sections.video.instance. Only the play and pause functions are available to me.

I see two possible solutions:

  1. We add a getter function to access the media instance. This could be a function getVideoInstance and getImageInstance, or with a little bit complexity a getMediaInstance function. This way child libraries will be able to control the media instances. A possible danger might be that child libraries have access to the media instance and might mess things up.

  2. Now the functions play and pause exists. Likewise we could add functions seek and getCurrentTime. Below is the list of possible functions to add:

  • seek
  • getCurrentTime
  • getDuration
  • getBuffered
  • mute
  • unmute
  • isMuted
  • getVolume
  • setVolume
  • getPlaybackRates
  • getPlaybackRate
  • setPlaybackRate
  • setCaptionsTrack
  • getCaptionsTrack
    For my requirements seek, getCurrentTime and getDuration would suffice. The remaining functions might not be meaningful to add to a question.

I would like feedback on my feature request. I am willing to provide code for both modifications in a pull request if you like the idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions