Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broadcast event before playing and after completing #13

Open
mfrederickson opened this issue Jan 5, 2014 · 4 comments
Open

broadcast event before playing and after completing #13

mfrederickson opened this issue Jan 5, 2014 · 4 comments
Assignees

Comments

@mfrederickson
Copy link
Contributor

See concerto/concerto#802

@mfrederickson
Copy link
Contributor Author

@bamnet can give give me a rough idea on the best way to implement this?

@bamnet
Copy link
Member

bamnet commented Jan 7, 2014

Certainly!

content.js has some good examples how to throw events. We define them at the bottom, and then you just this.dispatchEvent it to fire it away.

Listening might be the trickier part, as you'd typically setup to listen to the event on a specific object (like the video) instead of any object in the field. We probably need to clean up the frontend API to propagate some events at the field / position level to make this easier.

Maybe you could reach from the content up to the field and dispatch the event on the field.

@mfrederickson
Copy link
Contributor Author

Wouldn't the video content need to notify the screen and then the screen
need to propagate it to all content or at least all fields?

On Jan 6, 2014, at 6:57 PM, Brian Michalski [email protected]
wrote:

Certainly!

content.js has some good examples how to throw events. We define them at
the bottom, and then you just this.dispatchEvent it to fire it away.

Listening might be the trickier part, as you'd typically setup to listen to
the event on a specific object (like the video) instead of any object in
the field. We probably need to clean up the frontend API to propagate some
events at the field / position level to make this easier.

Maybe you could reach from the content up to the field and dispatch the
event on the field.


Reply to this email directly or view it on
GitHubhttps://github.com//issues/13#issuecomment-31711663
.

@bamnet
Copy link
Member

bamnet commented Jan 7, 2014

That's one way we could implement it, the screen could provide a pubsub mechanism. Playing sound is kind of a universal state which makes sense to propagate all the way up to the screen level, but I think it's one of the few exceptions.

If you look at something like the Google Maps API, you can setup an event listener to get fired when a marker is being dragged across the map. You do that by calling addEventListener(marker, 'dragged', function()) and some magic calls the function every time that specific marker is dragged. You could also do addEventListener(map, 'mousemove', function()) and deduce which marker is moving because those events are fired as well, but you'd have to deduce which marker is moving. The same thing applies here, it's not super useful for the screen to say "video is playing", maybe useful to say "audio is playing"... but it's certainly useful to hear that from the content and probably the field. (you could use that event listener to make a special video play icon pop up on the field, or a speaker if there's sound to help identify the source).

From the video side of things, I think it makes sense for video to broadcast from itself that it's playing. As a workaround you can broadcast on the field as well to make listening easier, but longer term we should make sure that certain events bubble up all the way to the screen, some get to the field, and some stay at the content level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants