0

I'm tyring to write an own custom directive for HTML video element, I got this:

finalCutApp.directive('finalcutPlayer', ($timeout) => {
    return {
        restrict: 'A',
        link: ($scope, $elem, $attrs) => {
            $elem.on('canplay', () => {
                $timeout(()=> {$scope.$emit('finalcutplayer.events.canplay')});
            });
        }
    };
});

So I got this markup:

  <video finalcut-player id="html5-player" controls>
    <source src="videos/react@iugh.mp4" type="video/mp4">
  </video>

So far I've achieved to get the event catched up at my controller. However I'm not sure how I can either programatically start the player or even change and reload its sources.

How can I achieve it?

||||||
1

$elem is Jquery object. You can access method and properties like this:

$elem[0].play();

Here's demo.

||||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.