Simple observable question


#1

I have an html5 video and I would like the ability to hit a button and for it to sync the current time across all instances of the video (on different browsers etc). I know that may not be a good idea and it would probably be better to sync with a specific user but this is just a test…

I thought an observable would be the answer since I could just call the next() function when I want (e.g. as a callback from another function) with the current time of the video and then in the onNext() function on the observable I could set the current time, e.g.:
this.video.nativeElement.currentTime = value

Am I being an idiot??


#2

that should work. I just tried something like @observable test = new Date().toLocaleTimeString(); and it was fine.

note, it does not auto update, you would need to put it into a function and call it when ever you want, but it will update across wherever the component is re rendered, so it should work.