Search code examples
javascripthtmlcssangularjsvideogular

How to apply css mark on videogular time line at specific time


I have an html player application where user can search a term ,then its populate the result with the time where those words occurs.On clicking that specific sentence the html player starts playing from that location. But with this functionality I want to add some mark on the videogular time line as we see in youtube .

enter image description here

Like youtube you can see the yellow marker at specific time..same way i want the css marker at the particular location. enter image description here

on right side search box if there is a sentence at 19:00 min then i want to set yellow marker at 19:00 ofvideogular timeline.

on click event of search button:

HTML:

<button class="btn btn-default side-search" type="button" data-ng-click="inlinSearch()"></button>

JS:

var onSearchSuccess = function (response) {
    $scope.inlineSearchResult = response.data;
    $scope.jsonResult = JSON.parse($scope.inlineSearchResult);
};
$scope.inlinSearch = function () {
    var counterSearch = 0;
    var textSearch = $scope.searchkey.toLowerCase().trim();
    scopraServices.searchWithin(textSearch, videoId)
                  .then(onSearchSuccess, function () {
                      alert("Search Operation failed");
                  });
};

Using ng-repeat I am binding the value on view:

<section class="scroll-content-container">
<article class="scroll-content" data-ng-repeat="sr in jsonResult" data-ng-click="Seek(sr.Location)">
<a>[{{util.formatTime(sr.Location)}}]</a>
<p ng-bind-html=util.boldText(searchkey,sr.Result[0].Text)></p>
</article>
</section>

Thanks in advance.


Solution

  • Here you have a demo: http://videogular.com/demo/#/cue-points Full code example: https://github.com/2fdevs/videogular/tree/master/app

    Basically, add a few cuepoints to Videogular and style them with CSS. You have a directive to show your cue points (vg-scrub-bar-cue-points):

    HTML

    <videogular vg-cue-points="ctrl.config.cuePoints">
        <vg-media vg-src="ctrl.config.sources"></vg-media>
    
        <vg-controls>
            <vg-play-pause-button></vg-play-pause-button>
            <vg-time-display>{{ currentTime | date:'mm:ss' }}</vg-time-display>
            <vg-scrub-bar>
                <vg-scrub-bar-current-time></vg-scrub-bar-current-time>
                <vg-scrub-bar-cue-points class="myCuepoints"
                                         vg-cue-points="ctrl.config.cuePoints.myCuepoints"></vg-scrub-bar-cue-points>
            </vg-scrub-bar>
            <vg-time-display>{{ timeLeft | date:'mm:ss' }}</vg-time-display>
            <vg-volume>
                <vg-mute-button></vg-mute-button>
                <vg-volume-bar></vg-volume-bar>
            </vg-volume>
            <vg-fullscreen-button></vg-fullscreen-button>
        </vg-controls>
    
        <vg-buffering></vg-buffering>
        <vg-overlay-play></vg-overlay-play>
    </videogular>
    

    CSS

    vg-scrub-bar-cue-points.myCustomCuepoints .cue-point {
        background-color: aqua !important;
    }