如何在特定时间在视频时间线上应用css标记

时间:2015-09-01 15:12:46

标签: javascript html css angularjs videogular

我有一个html播放器应用程序,用户可以搜索一个术语,然后用这些单词出现的时间填充结果。点击该特定句子,html播放器从该位置开始播放。 但是有了这个功能,我想在视频时间线上添加一些标记,正如我们在youtube中看到的那样。

enter image description here

像youtube一样,你可以在特定的时间看到黄色标记。我希望在特定位置使用css标记。 enter image description here

在右侧搜索框中,如果在19:00分钟有句子,那么我想在视频时间线19:00设置黄色标记。

点击搜索按钮的事件:

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");
                  });
};

使用ng-repeat我在视图上绑定值:

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

提前致谢。

1 个答案:

答案 0 :(得分:2)

在这里你有一个演示:http://videogular.com/demo/#/cue-points 完整代码示例:https://github.com/2fdevs/videogular/tree/master/app

基本上,向Videogular添加一些提示点并使用CSS设置它们的样式。你有一个指示来显示你的提示点(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;
}