Multiple Instance of AudioStreamer if tap too fast in tableview - audiostreamer

I'm having issues with the AudioStreamer which is driving me crazy. I have a tableview with songs from a remote server. When I click on a song it stream fine, but if I tap too fast I get multiple instance of AudioStreamer playing different songs.
I heard that making AudioStreamer a singleton will fix this issue, but I tried that and it crashes too often. Does anybody had faced this issue and founded a solution?
Thanks.
UPDATED:
The solution to this problem was to remove this line from the -(void)stop method. Also change anything that says state to self.state
if (state == AS_WAITING_FOR_DATA || state == AS_STARTING_FILE_THREAD)
return;

The solution to this problem was to remove this line from the -(void)stop method. Also change anything that says state to self.state
if (state == AS_WAITING_FOR_DATA || state == AS_STARTING_FILE_THREAD)
return;

I founded the solution in another post. But just in case, here is what I did wrong.
Another post here at stackoverflow pointed to the following link. I follow the solution in that link before but not completely. I missed the most important part which was below the code.
https://github.com/mattgallagher/AudioStreamer/issues/26
"The variable pausedByInterruption is needed since we only want to resume playing after an interruption iff audio was paused by an interruption. So, the ivar pausedByInterruption needs to be set to NO in the following methods: pause, start, stop and initWithUrl."
Let me repeated, make sure that you do this part "the ivar pausedByInterruption needs to be set to NO in the following methods: pause, start, stop and initWithUrl."
After doing this, my issue was resolved.

Related

Not able to set list2 in Adobe Launch in custom code

I am trying to set list2 in my analytics call through custom code but it is not getting set.
This issue comes with s.tl() only while with s.t() method, it is triggered correctly.
Below is the code :-
s.addEvent("event12", true);
s.linkTrackVars = "list2";
s.list2 = "Data"
s.tl(this, "d", "Download", s);
If I place logger just before beacon call, it shows the value. However, when I click the button and check for same, only "event12" get fired and not "list2".
Any help would be highly appreciated.
Just tested your code on lululemon:
Conclusion:
You're overwriting either the listvar or the linkTrackVars somewhere else. As #Crayton Mentioned above, doPlugins would be a good spot for it.
But it actually can be overwritten anywhere. In any rule that fires prior, or the s code, or any DE affected.
Paste your code into the console. Execute. Do you see the listvar populated? If yes, then your problem is in rules, so check them. You're not supposed to reassign linktrackvars. Always use the s.apl() plugin.
If no, however, then your problem is definitely in doPlugins. Sometimes I have it when I have silent catches in s code. Pageviews would have all vars populated, but links would have mixed results. Check your error reporting in the catches in doPlugins. I suggest having all code in doPlugins in a try catch.

How do i close div and reopen in reactjs

I am learning reactjs, and was making note taking app. Its working fine so far, but it isnt working when i close a note and then try to open same note again. If i open any other note than the one i closed it works fine.
I know that my if condition is causing this because i have below condition in my code nextProps.note.id !== this.state.note.id which only returns true if ids are different.
I tried many many variations but i am not able to implement note details and close feature all together. I know i am so close and just making some silly mistake, but i am not able to catch that mistake may be my reactjs understanding is weak.
If someone can point me in right direction or just give a clue that will be a great help, as i have spent many hours on this with no luck so far.
Demo : https://codesandbox.io/s/wqqklork
How to recreate bug : Click on note 1, then click close note button and then again click note 1 (this will not work), But if you click note 2 it will work.
I believe its an issue with component lifecycle,when you click a new note a whole new component is rendered but when you click on the same component twice,the second time a new component is not rendered but the same same one is updated. Check on the willcomponentupdate lifecycle method .Hope that helps.

Nothing happening when I click Post Comment button (ThinksterIO:Real Time Webapps tutorial)

I ran into another snag while going through the ThinksterIO Learn to Build Real Time Webapps tutorial around the 90% mark where one is shown how to add and delete comments:
https://thinkster.io/angulartutorial/learn-to-build-realtime-webapps/#adding-comments-functionality-to-the-post-service-9
Every time I click the Post Comment button absolutely nothing happen and I simply can't figure it out. I am expecting some kind of error to show up but nil. It's as if the button is not hooked up to the function. I was so frustrated that I eventually just copy and pasted the code from the tutorial to make sure I had it down right. Even after doing that it still didn't work.
I've created a Plunker with this app running over here http://embed.plnkr.co/OhzDTU/preview
You can sign in with the email user#user.com and 1234 password. You will then be able to try to comment on posts. Any ideas on what is going wrong here?
UPDATE
I took away the user user#user.com and 1234 password since problem is now fixed.
Your add comment button is in showpost.html, which is rendered by PostViewCtrl. However, your addComment method is attached to the scope of PostsCtrl (it doesn't exist when you try to click it). The simplest answer here is just to move addComment() over to the other controller.
Regarding the lack of error messages, I don't think that you can get an error for this. I had a look at the docs for $log and tried to decide if you could add some debugging output, but it looks like it's already on (i.e. the lack of a method seems to fail silently).
About your only option here is to try something like {{addComment|json}} in the view to see if it exists, but you'd first have to suspect that it didn't.

ng-grid : Why is afterSelectionChange() called twice?

I did not like the answer to this question. To my mind, it has a bad code smell.
I am new to Angular, so I thought I could learn something if I created a Plunk to help that questioner.
My Plunk is http://plnkr.co/edit/fJcew7cGCPzJ0nhIQXjg?p=preview, but there two things which I don't understand.
Please note that I assigned the ng-grid's data two ways - at one fell stroke and row by row. Comment one out & uncomment the other to play around with it.
And be sure to press F12 to see the developer's console log messages.
1) why am I getting TWO ngGridEventData events?
2) why, when I push() row by row am I not getting one ngGridEventData event per push() ?
I am trying to implement master/detail/even more detailed with 3 grids (nothing to do with the current question) and have been googling for a few days now. Many people seem believe that they will get multiple ngGridEventData events and want to know ho to detect that the grid is fully rendered (hence the check in my Plunk).
In short, can anyone explain in detail how ngGridEventData works? Thanks; your answer will help a lot of people.
In a recent Answer here I showed some learnings about this strange behavior. It seems that this routine is called 2 times for reasons I can't really understand (caching maybe?).
You can get this to work if you only react when the data-object is a clone:
if (data.selected === true) {
if (data.isClone) {
numSelectionChanges = numSelectionChanges + 1;
console.log("afterSelectionChange", 'Selection has chanegd ' + numSelectionChanges + ' times');
console.table(data);
}
}
Give it a try, and if you find out why this happens please let me know.
More findings update:
Have a look at this Plunker
I have included the ng-grid.js script directly in the plunker.
If you look at rows 3344-3349 you will find this piece of code:
$scope.$on('$destroy', $scope.$parent.$watch(options.data, dataWatcher));
$scope.$on('$destroy', $scope.$parent.$watch(options.data + '.length', function() {
dataWatcher($scope.$eval(options.data));
$scope.adjustScrollTop(grid.$viewport.scrollTop(), true);
}));
As you can see the there are two watchers applied which looks like a leftover from changes to me. (Although i'm not sure, with me being dumb and those guys being clever). However, if I comment the first line out everything seems to work as expected.
Be carefull when you try this out, because it may break other functionality. I'm not very comfortable with hacking in such a lengthy source code. If someone who is an actual ng-grid team member sees this he can tell me if I found a bug and how to report it. (Never done that before!)

Key capture directive not working as intended in Angularjs

i am trying to capture keypress events in my angular app.
The intended functionality is that upon pressing g1 (i.e simulataneously pressing g and 1) the app should transition to state1. Upon pressing g2 the app should transition to state2 and so on.
However the app does not seem to be capturing two keypresses simulataneously. What am I missing here ?
Also is this the best way to achieve this or are there better solutions available.
You can see the plnkr here
http://plnkr.co/edit/sK0NYNDRtH4lFfteNd5O
You could pass the e.codeValue to a service/controller which then stores the keys pressed in an array.
On key press up, tell the service/controller to remove it from the "key pressed" array.
In the service/controller, you can then use your logic to see if g and 1 are in the array - if they are, do the state transition. That could work, although not 100% if it's the best way. Give it a try and let us know if it worked for you.
Javascript is single-threaded, so there is no way for the following if statement to ever run the true block:
if (x == 3 && x == 4) {
// true
} else {
// false
}
Aside from that, the real problem you're facing is that (to my knowledge) the browser does not directly expose rollover scan codes to Javascript. By the time the browser gets the keystrokes they're already de-rollovered (if that's a word).
BTW, style note: It's better to post your code here on Stack Overflow to save it for posterity for other readers to learn from. Adding a plunkr is a nice courtesy, but it's secondary.

Resources