Problem with multiple Audio Clips in Instagram - spark-ar-studio

So I got a conditional statement to switch between two audio clips (.m4a, mono, 44.1kHz, acc) as inputs for the audio player.
In SparkAR everything works as intended, but in Instagram I can only hear the song which should be played when the condition is false. Like the "default".
Here is my setup:
Unfortunately I can't send you the project or a preview of the filter as it's confidential work for an upcoming release of a musician.
I also tried using two speakers and changing their volume according to the conditional statement. But that doesn't work either.
I'm guessing it has something to do with using the wrong type for output in the condition? But there is no audioclip type and it works for one song, so I'm not sure.
Has anybody ever had a similiar problem and knows how to fix it?
Thanks a lot!

I have solved a similar problem utilizing multiple speakers, one for each audio clip:

On Instagram, check whether the condition passed to IF patch changes to TRUE or not.
I hope you have set the Patch Type of IF patch to "Text".

Related

HTML inside JSON

I'm using an API to get some data, but one of the JSON values, contains HTML inside of it. Is there a way for me to use the HTML tags that are inside the JSON value exactly like they are shown, instead of having to make the exact same HTML tags in my MVC view, and editing these ones out? If this wasnt descriptive enough heres an example of what i mean:
This is just one of the JSON values, I didnt wanna paste the whole thing:
"detail": "<h1>Overwatch Patch Notes – October 19, 2016</h1>\r\n\r\n<p>A new patch is now live on Windows PC. Read below to learn more about the latest changes.</p>\r\n\r\n<p>To share your feedback, please post in the General Discussion forum.<br />\r\nFor a list of known issues, visit our Bug Report forum.<br />\r\nFor troubleshooting assistance, visit our Technical Support forum.</p>\r\n\r\n<p>Please note that these changes will be rolled into a larger patch for PlayStation 4 and Xbox One at a later date.</p>\r\n\r\n<h2>BUG FIXES</h2>\r\n\r\n<p><strong>General</strong></p>\r\n\r\n<ul>\r\n\t<li>Fixed an issue causing the default Overwatch spray to override a player’s chosen spray when watching a Play of the Game or Highlight</li>\r\n\t<li>Fixed an issue causing players to frequently disconnect while viewing Highlights</li>\r\n\t<li>Fixed a bug preventing the appropriate music from playing after a loss on the Junkenstein's Revenge Brawl</li>\r\n</ul>\r\n\r\n<p><strong>Gameplay</strong></p>\r\n\r\n<ul>\r\n\t<li>Fixed a bug causing multiple issues when displaying data on the leaderboards</li>\r\n</ul>\r\n\r\n<p><strong>Heroes</strong></p>\r\n\r\n<ul>\r\n\t<li>Fixed an issue preventing Ana’s Nano Boost callouts from being heard by the enemy team</li>\r\n\t<li>Fixed a bug preventing players from receiving credit toward the Healing Done commendation when healing D.Va’s mech</li>\r\n\t<li>Fixed a graphical issue that was preventing the liquid in Mei’s Endothermic Blaster from appearing</li>\r\n\t<li>Fixed a bug causing Reinhardt’s Charge to unexpectedly stop when crossing certain thresholds (e.g. when exiting a dropship)</li>\r\n\t<li>Increased the volume of Roadhog’s “Want some candy” voice line</li>\r\n</ul>\r\n\r\n<p><strong>Map</strong></p>\r\n\r\n<ul>\r\n\t<li>Fixed a bug on Eichenwalde that caused some textures to stretch across the map for some players</li>\r\n</ul>\r\n".
You can use Html.Raw inside your view to use the raw string value:
#Html.Raw(Model.detail);
https://msdn.microsoft.com/en-us/library/gg480740(v=vs.118).aspx

Chrome: Wrong sound when changing the audio source for Audio element and MediaStreamAudioDestinationNode

I have a app where I play different code-generated sounds. I place these sounds in a AudioBufferSourceNode.
I allow the the user to choose what output device to play the sound through, so I use a MediaStreamAudioDestinationNode with its stream used as the source for an Audio Element. This way when the user chooses an audio output to play the sound to, I set the Sink Id of the Audio element to the requested audio output.
So I have AudioBufferSourceNode -> some Audio Graph (gain nodes, etc) -> MediaStreamAudioDestinationNode -> Audio element.
When I Play the first sound, it sound fine. But when I create a new source and connect it to the same MediaStreamAudioDestinationNode, the sound is played with the wrong pitch.
I created a Fiddle that shows the problem.
Is this a bug, or am I doing something wrong?
The problem was identified based on the OP Chrome Ticket.
It seems to come from the lack of sync between AudioElement and its source AudioNode (AudioBufferSourceNode, OscillatorNode, etc.) when you pause the source and play it back again.
The solution is to always call AudioElement.pause() and AudioElement.start() alongside your source stop and start.
https://jsfiddle.net/k1r7o0xj/3/
It's possible to dynamically change your graph layout by using .connect() and .disconnect(), even when audio is playing or sent through a stream (which could even be streamed over WebRTC).
I couldn't find a reference in the spec, so I'm pretty sure this is taken for granted.
For example, if you have two AudioBufferSourceNodes bufferSource1 and bufferSource2, and a MediaStreamAudioDestinationNode streamDestination:
bufferSource1.connect(streamDestination);
//do some other things here, and after some time, switch to bufferSource2:
//(streamDestination doesn't need to be explicitly specified here)
bufferSource1.disconnect(streamDestination);
bufferSource2.connect(streamDestination);
Example in action.
Edit 1:
Proper implementation:
According to the Editors Draft on the Audio Output API, it is planned/will be possible to choose a custom audio output device for the AudioContext as well (by means of new AudioContext({ sinkId: requestedSinkId });). I couldn't find any info on the progress, and even found a related discussion which the asker apparently read already. According to this and (many) other references, it doesn't seem te be an easy task, but it's planned for WA V1.
Edit:
That section has been removed from the API Draft, but you can still find it in an older version.
Current workaround:
I played around with your workaround (using a MediaStreamAudioDestinationNode and Audio object), and it seems to be related to nothing being connected. I modified my example to toggle a single buffer (similar to your example but with an AudioBufferSourceNode), and observed a similar frequency drop. However, when using a GainNode inbetween and setting it's gain.value to either 0 or 1, the frequency drops disappeared (this isn't gonna be the solution if you want to create and connect new AudioBuffers dynamically).

How to get an external SWF to play on only one frame AS3?

I have an external SWF file loading perfectly fine to my Flash site. However, once the frame has been viewed, it carries on running in other frames when I only want it to play on frame 6. Any suggestions would be great. Thanks in advance.
Are you using a ViewStack? Make sure everything's embedded specifically into the right child of the ViewStack. If that's not the problem, edit your answer (don't just comment) so as to take the code you mentioned in your comment, and not only show that, but also the code whose greater context it falls under (like the scope of the URLRequest).

HTML5 video - playing only a portion of a video

Is there some straightforward technique to play only a certain part of a HTML5 video? For example in a 30 second clip I would like to play only the part 5-20 sec. Additionally the rest of the video should not be accessible from the UI at all (meaning the video timeline should only show the 5-20 sec part).
I've been going through some HTML5 video players but none of them seem to be supporting this kind of functionality. If anyone knows a (good) way to implement this feature please give me a hint.
Thanks in advance!
Even though this question has already been marked as answered, here's something that may interest you and anyone else who stumbles across here: Specifying playback range.
It's part of the Media Fragment API and currently works in the latest versions of Firefox, Chrome and Safari 6+.
You can implement it there is a Player.Play() event in a players, whenever Play() called start a timer and call the Player.stop() on the specific time you want.
I got the same problem and I didn't found something that can solves this problem, what you can do is to implement your own controls and display the video with a canvas...
and if you are trying to implement this in IOS you will not be able to do it.
My thought would be to use custom controls, as I don't believe that functionality is available natively. All the functionality of html5 controls (play, pause, start at timestamp, etc.) can be called via javascript. In this case you are going to want to edit the currentTime variable.
So you may want to consider setting up your own slider, where the start of the slider represents your starting point, and the end your ending point. Set the video to not play on page load. Then on page load have a javascript function change the currentTime to your starting point. For stopping you could occasionally query the currentTime. I wouldn't use a timer as delays like slow loading could throw it off.
I am trying to implement a similar video in "Preview Mode". I am utilizing the methods stated above by adding an event listener and then pausing the video at a currentTime()=='x' postition. To prevent user from simply hitting play again, the currentTime listener wont allow playback past the 'x' time in the timeline so each time the user hits play, it is automatically instantly paused again. Furthermore, at time 'x' the video container will become hidden through CSS thus preventing interaction from the user with the video.

How do you make an embedded flash player open the little window telling them to update it?

The flash player has a little window that can be opened (similar to flash->settings) telling the user to update the player if the movie loaded is for a more recent version. How can you instruct the player to do this? ITV have managed it with their catchup-tv player.
Context: I am allowing users to copy flash into their PowerPoint presentations and would like to tell them to update their flash player if necessary. I am not embedding a web page in the power point so no JS can be run for checking etc (because I know this is not necessary).
Thanks in advance
For getting the current version of flash:
var version:String = Capabilities.version;
I don't know what ITV has done, but I don't know of any way of forcing the player to show that box, although it may do it automatically.
EDIT:
I just found a complete blog post that answers this.
There is no way to force the window to open itself. It's a user defined setting:
Have a look at the Security class. I have used it in some Flash to prompt users to increase storage limits. The panels that you can show are found in SecurityPanel. However, this may not be the way to prompt for outdated Flash version. (If you are looking to customize these panels, that is off limits.)
You can actually test the browser/Flash version in Javascript, so there really is no point in loading Flash to tell the user to upgrade Flash.