Giter Club home page Giter Club logo

Comments (4)

TimLeenaers avatar TimLeenaers commented on June 3, 2024 2

Hi @theraw
As @PooriaN already mentioned, it is possible to pass a percentage to timeOffset, just like you did in your example.
To show the visual cues, however, you should modify the detectTimeOffset() function from the ui-visual-cues-midroll example a bit (this currently only draws cues for seconds, 'start', and 'end'). This can be done in the following way:

function detectTimeOffset() {
        if (adsPresent) {
          var t = 0;
          for (var ad of player.source.ads) {
            to[t] =
              ad.timeOffset == undefined
                ? 0
                : ad.timeOffset == "start"
                ? 0
                : isNaN(ad.timeOffset) && ad.timeOffset != "end"
                ? (parseFloat(ad.timeOffset.replace("%", "")) / 100) *
                  player.duration
                : ad.timeOffset;
            t++;
          }
        }
      }

from samples-html5-sdk.

theraw avatar theraw commented on June 3, 2024 1

@TimLeenaers that's working perfectly thank you
@PooriaN thank you

from samples-html5-sdk.

PooriaN avatar PooriaN commented on June 3, 2024

Hi @theraw,
Thank you for your question, this function is definitely possible, you can check out this example:
https://codesandbox.io/embed/github/THEOplayer/samples-web/tree/master/?fontsize=14&hidenavigation=1&theme=dark

from samples-html5-sdk.

theraw avatar theraw commented on June 3, 2024

hello @PooriaN
i'm trying to look over demos but i can't find the one where is used a timeOffset with percentage, can you please tell me the name which one is it?!

from samples-html5-sdk.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.