使MediaElementJS与Angularjs一起使用

时间:2016-08-29 06:35:00

标签: javascript angularjs mediaelement

我正在创建一个流媒体网站,我想在网络中使用名为MediaElement.js的嵌入播放器播放m3u8

我应该将它与angularJS一起使用,但它不起作用! 这是代码:

HTML:

    <script src="/static/libs/jquery/jquery.js"></script>
    <script src="/static/libs/mediaElement/mediaelement-and-player.min.js">   </script>

    <link rel="stylesheet" href="/static/libs/mediaElement/mediaelementplayer.min.css" />
    <script type="text/javascript" src="/static/libs/mediaElement/hls_streams.js"></script>
        <img ng-src="{{imagesBaseUrl}}{{recipe.bg_image}}" alt="Cover">
        <video controls name="media" class="sticky to-left to-top" id="video-{{recipe.id}}">
            <source ng-init="loadMediaElement()" type="application/x-mpegURL" src="http://st.vasapi.click:1935/vod/__default__/smil:20a57a4c-1377-4fb8-b6cb-ec8e044650ac.smil/playlist.m3u8?wprefixendtime=1472459158&wprefixhash=hqfkboYJw5K7lAvufT9t5ibZVOARBzxIunJBP0lJDLQ%3D&wprefixstarttime=0" />
        </video>
        <span class="play-button sticky" toggle-video="true"></span>
        <span class="pause-button sticky" toggle-video="false"></span>

控制器:

  $scope.loadMediaElement = function()
{
    $('video').mediaelementplayer(/* Options */);
    console.log('called');
};

但没有运气!我做错了什么?

0 个答案:

没有答案