angular-youtube icon indicating copy to clipboard operation
angular-youtube copied to clipboard

Some docs and usage examle

Open BeOleg opened this issue 12 years ago • 4 comments

I browser you code, and it seems to me that your service produces an instance of a video using the YouTube JS api statically. Which is basically the same is using an embed flash player. And won't allow users to add their own video for instance.

Instead of creating the video instance at the link function of the directive, perhaps it could be nice to pass it as a 2-way-bind attribute.

I can implement something like this and open a PR, if you are interested.

Also, regardless of the usage example for the existing code could be great, thanks :+1:

BeOleg avatar Dec 16 '13 15:12 BeOleg

I made a fork that does a nice two-way binding and has usage examples.

brandly avatar Mar 13 '14 06:03 brandly

The API YT player is quite similar to the embeded one but this one does have a control to stop and play the video and more. I didn't manage to get the embedable player to do the same. However I had issues with getting this player to initialise quick enough for me. So I am using the much simpler embeded player and setting the video to a fake video id does indeed stop the video from playing !

landed1 avatar Mar 13 '14 09:03 landed1

@landed1 I added some documentation about controlling the player: https://github.com/brandly/angular-youtube#events-and-player-controls

You could stop the player from within a controller.

myApp.controller('MyCtrl', function ($scope, $youtube) {
  $scope.stopPlayer = function () {
    $youtube.player.stopVideo();
  };
});

@arnaudbreton I've made quite a few changes already, and I'm considering more. If you'd like me to open a pull request for any or all of these changes, I'd be happy to! Otherwise, I might break off into my own repo, since I can't file issues or anything on a forked repo. :fork_and_knife:

brandly avatar Mar 15 '14 18:03 brandly

@brandly Yes I would be happy to review and merge your PR in the main repo! Feel free to submit them. Thanks for your contribution.

arnaudbreton avatar Mar 26 '14 23:03 arnaudbreton