feature: Play custom sound on ng serve transpliations error
feature: Play custom sound on ng serve transpliations error why? because I often run the window doing transpliations when in dev mode and if there is an error I don't know about it until I run the app. It would be great if I can play a custom short mp3 that will bring to my attention that ng serve has failed so I can fix the bug before running the app in the browser again,
tx
Sean
Sean, that is not a good idea. If you want that, then put it in your project somehow. it's not hard to do. Goddamn, N-words be trying to make a mashup with my clock cycles.
how can I do it as I don't have access to underline webpack with ng-cli? regards
you know, this isn't that bad of an idea, i'm going to do this in my project this afternoon (hopefully) and I'll post a link to the githubs. please stand by...
Sweeeeet, tx!
yeh turns out this is so frickin easy to do w/o touching any of the webpack stuff. I did in my project, with a service and a component. I decided to make mine talk instead of playing a sound binary. I like it a lot. That was a great idea I just stole from you. Plz stand by, spaceship are docking at d'githubs.
great, ya let me know how you are detecting it, tx...
well, i just threw away your assumption that it needs to be in the build process somewhere. it isn't needed there. if you put a component backed by a service that generates a sound wave, declare that component in you app.component.html, execute "ng serve", and you are off to the races. when your computer stops talking to you, you know that something just got brokified. i'll githubbit a bit later, i have to go do a few things with my arms and legs.
this approach could also work with both unit (i wouldn't do that, but u might like to) & e2e testing with very little additional effort. thank u and u r welcome.
import {Injectable} from '@angular/core'; import {Logger} from 'angular2-log4ts/src/app/core'; import {ClientWindowService} from "app/services/client-window/client-window.service";
@Injectable() export class SpeechApiService {
constructor(private _logger: Logger, private clientWindowService: ClientWindowService) { //do nothing }
public utter(verbals: string, params: any): void { let client: Window = this.clientWindowService.getNativeWindow(); //only attempt utterance if client is speech enabled if ('SpeechSynthesisUtterance' in client) { //bootstrap the tts let utterance: SpeechSynthesisUtterance = new SpeechSynthesisUtterance(); utterance.text = verbals; utterance.lang = params.lang; utterance.rate = params.rate; let instance: SpeechApiService = this; utterance.onend = function (event: SpeechSynthesisEvent) { instance._logger.debug('Utterance Finished in ' + event.elapsedTime / 1000000000 + ' seconds. At time ' + new Date(event.timeStamp).toLocaleString()); }; speechSynthesis.speak(utterance); } } }
=======================
import {Component, OnInit} from '@angular/core'; import {Logger} from 'angular2-log4ts/src/app/core'; import {SpeechApiService} from "app/services/speech-api/speech-api.service"; import {ClientWindowService} from "app/services/client-window/client-window.service";
@Component({ selector: 'app-speech', templateUrl: './speech.component.html', styleUrls: ['./speech.component.scss'] }) export class SpeechComponent implements OnInit {
constructor(private _logger: Logger, private _speechApiService: SpeechApiService, private _clientWindowService: ClientWindowService ) { // do nothing }
ngOnInit() { if (this.isSpeechCapableClient()) { let agents = this._clientWindowService.getNativeWindow().navigator.userAgent.split(' '); let welcomeMessage: string = 'Welcome Browser Speech Activated, ' + agents[0] + ', ' + agents[1] + ', ' + agents[2]; this._speechApiService.utter(welcomeMessage, { "lang": "en-US", "rate": "1.6" }); if (this._logger.isDebugEnabled()) { this._logger.debug('Success: Speech Component initialized.') } } }
public isSpeechCapableClient(): boolean { let client: Window = this._clientWindowService.getNativeWindow(); return 'SpeechSynthesisUtterance' in client; } }
Thank you for the effort I appreciate it.
Personally I think it would be counterproductive to wait for a pass sound on the client-side. the idea is to get a sound on an issue so it can prompt attention. so I do believe this needs to be addressed as part of the build process, to detect when webpack fails... I'm sure there's a way to do it if we had access to the underlined webpack..
regards
Sean
Seems to me that you aren't really waiting for anything. after a day or 2 I think you'll be having a subconscious event fire in your head when the computer stops whispering sweet nothings to you. am i right? that would work me. I guess if you are in a noisy work env, this might be annoying for others and not very effective for u. i'm sure it's very easy to do either way. pending the CLI engineers accepting our requests to expose the webpack config in the cli to our application/bootstrap code.
let's hope the team can add it to the build process
We won't add sounds or notifications. This would be a good use case for the addon system we'll develop this winter. Closing this as Won't Fix.
great will look fwd to it... tx
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.