GithubHelp home page GithubHelp logo

Comments (5)

colthreepv avatar colthreepv commented on July 21, 2024

mmh you're quite right, it might come up handy.

I think that angular does compile the directive AFTER the link function so i am in a bit of trouble finding the right place to call for $rootScope.$emit

from angular-media-player.

colthreepv avatar colthreepv commented on July 21, 2024

I lied, it wasn't hard after all!

How to use it:

angular.module('docs')
.controller('InteractiveController', function ($scope, top100SongsEver, $log) {
  $scope.$on('audioplayer:ready', function (evt, instance) {
    debugger;
    // Here you can use 'instance' as the created audioPlayer
    instance.load();
  });
});

Keep note that the default name is 'audioplayer' 😱 (such creativity!), so the event for the 99% of users will be called audioplayer:ready

About releasing this feature: i need to make a minor release, and i will do it as soon as i have more time, you can build it quite easily with grunt build in meantime

@aw-emberex tell me if that is what you were after

from angular-media-player.

colthreepv avatar colthreepv commented on July 21, 2024

As @aw-emberex reported:

When this event is fired, the exposed player on my containing scope is still not set ("$scope.audio1") per the example. Is this something the plugin can remedy or is it a angular thing/issue?

This is true.
I googled the best i could to find informations about how angular.js isolated scopes and their two-way databinding work, it is still unclear to me when and how the databinding gets done.
I can suppose it happens after the linking function is done executing, so probably using:

$timeout(function () {
  $log.debug($scope.audio1);
});

Would find your $scope populated

This is the best link i could find.
To have a better idea i've to dive into the code, something i will do, but.. really... when i have time for that ;)

from angular-media-player.

aw-emberex avatar aw-emberex commented on July 21, 2024

Is the ability to set a name in the main branch yet?
I still have a forked version I'm using so I can have properly namespaced audio players. I have several on a page.

from angular-media-player.

colthreepv avatar colthreepv commented on July 21, 2024

Name is not useful anymore since events will not be sent to $rootScope.
Check out https://github.com/mrgamer/angular-media-player#events

from angular-media-player.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.