【问题标题】:How to apply css mark on videogular time line at specific time如何在特定时间在视频时间线上应用css标记
【发布时间】:2015-11-26 21:36:20
【问题描述】:

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

像 youtube 一样,您可以在特定时间看到黄色标记。我希望 css 标记位于特定位置的方式相同。

在右侧的搜索框中,如果 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>

提前致谢。

【问题讨论】:

    标签: javascript html css angularjs videogular


    【解决方案1】:

    这里有一个演示: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;
    }
    

    【讨论】:

    • 感谢@elecaash。但是在控制器内部,需要将哪些值传递给controller.config.cuePoints:
    • cuePoints: { myCuepoints: [2,4,12,40] },
    • 它必须是一个对象数组,对象定义见文档:videogular.com/docs/#/api/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-16
    • 2018-08-28
    • 1970-01-01
    • 2016-06-12
    • 2011-02-24
    • 2018-11-07
    • 2022-07-09
    相关资源
    最近更新 更多