Soundcloud record flash plugin don't work with current version of chrome under macOS - soundcloud

this record plugin stops to work for us with current version of chrome under macOS
Chrome: Version 23.0.1271.97
MacOS: 10.8.2
http://connect.soundcloud.com/examples/recording.html
how to reproduce:
click record
allow using your microphone
-> recording don't start
(In fact sometimes it works (20% of cases for me))
and also sometimes there is an error in console
PepperFlashPlayer.plugin: 0x2A052 is not valid resource ID.
Please help us, we use it for production and a lot of users can not record sound
regards, Dmitry

My investigation show:
sometimes the "SampleDataEvent.SAMPLE_DATA" event not triggered (or not assigned) in flash.
To solve this issue I do:
Added to event handler "StatusEvent.STATUS" (or call manually if microphone unmuted):
tti = setInterval(applySampleData, 100);
Added function:
protected function applySampleData() : void {
microphone.removeEventListener(SampleDataEvent.SAMPLE_DATA, recordSampleDataHandler);
microphone.addEventListener(SampleDataEvent.SAMPLE_DATA, recordSampleDataHandler);
}
And in function "recordSampleDataHandler" (it's SampleDataEvent.SAMPLE_DATA listener):
if(tti) { clearInterval(tti); tti = 0; }
Try this.

Related

Agora SDK not working in Windows Build. VideoSurface.cs always gets tmpi = -1 in Update

I am trying to implement Screen broadcast with Unity using the Agora Video Chat SDK for Unity. I used this source, which doesn't work initially. But after modifying the code as below, I am able to receive my own stream through the server, inside Unity editor (2019.1.2f1).
//Adding inside Start
mRtcEngine.OnJoinChannelSuccess = Joined;
}
private void Joined(string channelName, uint uid, int elapsed)
{
var videoSource = FindObjectOfType<VideoSurface>();
videoSource.SetForUser(uid);
videoSource.SetEnable(true);
}
But nothing happens in the Windows build. I checked the VideoSurface.cs file. I am continuously getting tmpi = -1 inside Update. What could be the reason?
PS. I check all firewall permissions for the build. Also, the user is able to join the channel. It's just the stream that is not being received. Help appreciated.
You shouldn't need to modify the code like that. And also, in the code above you register the callback for the local user. If you want to show remote user's video, you should register the callback for OnUserJoined().
Have you seen the tutorial about the Screensharing? https://www.agora.io/en/blog/how-to-broadcast-your-screen-with-unity3d-and-agora/
Please try that. If you are still confused, you may take a look at this github repo. It has different contents to share, but the concept and Agora API usage are pretty much the same.

Voice message capture no longer working regardless of Secure Context / HTTPS on mobile

I am building an appointment scheduling web app (calendar like) that allows users to leave voice messages (explanations) at certain time points that others can retrieve remotely at their convenience. It works well on PC but I can't get it to work on mobiles anymore. Apparently new security context standards are in place (WebRTC?) and a Secure Context must be provided, but though I am using HTTPS (SSL Site/Domain), I can't get it to work in any of the major browsers. How else can I provide such a Secure Context?
The code I attach is quite popular and used to work well (it still does on laptops!). What can I do to provide the right context on mobile-phones (IOS, Android, Tablets)? Thank you for any help.
navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
//console.log("getUserMedia() success, stream created, initializing Speakit_recorder.js ...");
audioContext = new AudioContext();
//update the format
/* assign to gumStream for later use */
gumStream = stream;
/* use the stream */
input = audioContext.createMediaStreamSource(stream);
/* Create the Recorder object, configure to record mono sound(1channel). Recording 2channels will double the file size */
rec = new Recorder(input,{numChannels:2})
//start the recording process
rec.record();
//console.log("Recording started");
}).catch(function(err) {
//do whatever is necesssary if getUserMedia() fails
});
This might be due to the autoplay changes that landed in Chrome 71. See https://developers.google.com/web/updates/2017/09/autoplay-policy-changes as well as https://bugs.chromium.org/p/chromium/issues/detail?id=835767 for details.
You might want to log audioContext.state is 'running'. If not, you need to call audioContext.resume() on a user action (such as a button click)

Delete Apk after app installation

I am working on an app in which I have to restrict the user to share the apk personally. One can download it but should not be allowed to share the App (apk) personally via bluetooth etc.
I searched and read alot about the same issue but didn't find a complete answer. I have tried the below.
How to get the file *.apk location in Android device
Download, Installing and Delete .apk file on android device programmatically from a website other than marketplace
What I have understood from above is that the easy way to do this is to delete the apk file from the User's device after the app is installed. (I also know that user may generate this apk again via root access but that is fine as at-least I will be able to restrict not all but many).
Now what I have tried, I am registering a Broadcast receiver and in my onReceive() method I have the below,
PackageManager pm = getPackageManager();
for (ApplicationInfo app : pm.getInstalledApplications(0)) {
if (myPackage.equalsIgnoreCase(app.packageName)) {
apkPath = app.sourceDir;
break;
}
}
Log.d("Package", myPackage + " - APK - " + apkPath);
if (intent.getAction().equals("android.intent.action.PACKAGE_ADDED")) {
File sdcard = Environment.getExternalStorageDirectory();
File file = new File(sdcard, apkPath);
file.delete();
}
But this does nothing as I am not aware of the IntentFilter I should use to register this.
Can any one guide me on what is the next step? and in case I am completely on a wrong land then help me achieve the above?
Any help will be appreciated. :)
On later versions of Android, some (all?) broadcasts aren't sent to an app until it has been manually opened at least once. This is a security feature that can't be circumvented.
As far as I know, It is not possible to listen the installation complete broadcast event. Android Api having Broadcast Action: "ACTION_PACKAGE_ADDED" But newly installed package does not receive this broadcast. Source : Here
My suggestion is check in your first launcher activity and delete the apk.
You can use the Android App Licensing Service here.
Refer http://developer.android.com/google/play/licensing/index.html and the implmentation here http://developer.android.com/google/play/licensing/adding-licensing.html.
This will ensure that the apk cannot be shared(making it protected) using any of the apps available on market.
Sorry for bad english.
Here my solution not actual code:
1) set your broadcastreciver when any new application is install in your device.
2) When your broadcastreciver is call, that time you write code in onRecive() method
check the your app package if install or not
private boolean isPackageInstalled(String packagename, Context context) {
PackageManager pm = context.getPackageManager();
try {
pm.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES);
return true;
} catch (NameNotFoundException e) {
return false;
}
}
using this method or any
if you get true means your application is install
3) if you get true from isPackageInstalled("com.download.app", context) method
that time delete apk file from your SD card or any loaction in device
if you more clarification i will be explain.
i used the idea of creating a folder when the app runs for the first time .if it doesnot exist , delete the apk. if the folder exists , then the apk has already been deleted.
This folder will be deleted on its own if the app is unstalled.
public static String link = Environment.getExternalStorageDirectory()
.getPath() + "/Android/data/YourAppPackageName/";
//check if its running for the first time
File f = new File(link);
if (f.exists()) {
File f1 = new File("/data/app/YourAppPackageName.apk")
if(f1.exists()){f1.delete();}
}
else {
f.mkdirs();
}
You can also use the HockeyApp product and distribute using the Android App that they provide, as well as enable the "restriction" features. I'm pretty sure that will do what you need without having to write extra code.

How to cause a chrome app to update as soon as possible?

Deploying a chrome packaged app and publishing updates on the chrome web store allows users to automatically receive application updates. There are situations where you want to know if the running application is the most current or not, and updating it. E.G.:
Just keeping the user on the most recent version.
Detecting a mismatch between the application and server side APIs, and requiring the client side application to update to use new server side APIs.
Documentation for chrome.runtime.requestUpdateCheck() offers a status of "throttled", "no_update", "update_available", but doesn't indicate what to do if a newer version is required.
Install a listener for chrome.runtime.onUpdateAvailable, which fires when the new .crx file has been downloaded and the new version is ready to be installed. Then, call chrome.runtime.requestUpdateCheck:
chrome.runtime.onUpdateAvailable.addListener(function(details) {
console.log("updating to version " + details.version);
chrome.runtime.reload();
});
chrome.runtime.requestUpdateCheck(function(status) {
if (status == "update_available") {
console.log("update pending...");
} else if (status == "no_update") {
console.log("no update found");
} else if (status == "throttled") {
console.log("Oops, I'm asking too frequently - I need to back off.");
}
});
Depending on your application, when an update is detected you may want to use something like setTimeout and call chrome.runtime.restart() or chrome.runtime.restart() later
According to the Google Chrome documentation you need to have
chrome.runtime.onUpdateAvailable.addListener(function(details) {
chrome.runtime.reload(); // To restart the chrome App instantaneously
});
But this take time to reflect JS changes into the chrome because background.js loaded into the background and it needs to be unloaded and loaded again
To cop this situation you need to include
chrome.runtime.onInstalled.addListener(function(details) {
chrome.runtime.reload();
});
as wel.
onInstalled called whenever google extension installed first time (fresh installation), google extension updated or google chrome updated.

Debugging with KBX extension : how to avoid having to deploy at every code modification?

I am currently debugging my apps so they can run with the KBX extension. KBX extension runs the last deployed version so everytime I change some code in the appbuilder I need to redeploy to see the changes. Could the Kynetx team give us a modified KBX extension that uses the last saved version instead?
We do have plans to make the KBX more developer friendly, but in the meantime, there are a few tricks.
We recommend spending most of your development time testing with bookmarklets, as these give you greater control over when your actions fire, allowing easier inspection between the state of the page before and after your rules fire. Applications can be tested with bookmarklets with no change to the code, and are easy to use.
This does not help debugging in the rare case that your application behaves differently while running in the KBX, but it should get you past most troubles you are currently experiencing.
Here is a solution for Chrome and Firefox: a modified KBX extension that targets the latest version of apps: http://blog.lolo.asia/technology/kynetx/2011/04/16/debugging-with-kbx-extension-how-to-avoid-having-to-deploy-at-every-code-modification/
In short, I replaced :
KOBJ.add_config_and_run({‘rids’:response.apps});
with :
//patch run_latest_app_version_in_kbx
var run_latest_app_version_in_kbx= true;
var run_msg_json={‘rids’:response.apps};
if (run_latest_app_version_in_kbx===true){
for (var i=0;i<response.apps.length;i++){
run_msg_json[response.apps[i]+’:kynetx_app_version’]=’dev’;
}
}
KOBJ.add_config_and_run(run_msg_json);
//
in page_interaction/pages.js inside the Chrome extension and
in resources/jid0-njkmo4quo4rc8p9kcuemahnyiku-kynetxforfirefox-data/page_interaction.js inside the Firefox extension