Why is the image being removed from the cache? | Kingfisher - swiftui

I am using Kingfisher on SwiftUI. I download the image from url with Kingfisher
I will explain the problem step by step:
I download the image from url
After I close my own application from the background, I open the Instagram application and scroll down continuously on the main page and I make the Instagram application use the cache.
Then I turn off the internet and open my own application.
Problem: When I turn off my internet and open my own application again, I cannot get the pictures from the cache. Why ?
.diskCacheAccessExtending(.expirationTime(.never)) and .diskCacheExpiration(.never) I used these two functions, but the images are still deleted from the cache.
KFImage:
KFImage.url(URL(string: value))
.resizing(referenceSize: CGSize(width: 50, height: 50), mode: .aspectFit)
.diskCacheExpiration(.never) // 1
.diskCacheAccessExtending(.expirationTime(.never)) // 2
.loadDiskFileSynchronously()
.fade(duration: 1)

Related

How to trigger and process a stream's interruption on AWS MediaLive?

I have a MediaLive channel with attached input and OBS streaming into it. An output in several different resolutions saves into a bucket on AWS MediaStore. Everything goes well until eventually, my client loses a connection for a few minutes. During this downtime, MediaLive records a video with a black screen.
1) Can I prevent MediaLive from streaming the "black" video, stop output and wait for the streamer to connect again?
2) Can I replace a black screen with some image as a placeholder to notify users what's happening?
3) Can I trigger somehow when the streamer connects or disconnects from the input?
In the channel settings, there is an option which I suspect to be the answer - Blackout Slate. That's how it looks in the web interface:
The info block states the following:
Setting to enabled causes the encoder to blackout the video, audio, and captions, and raise the "Network Blackout Image" slate when an SCTE104/35 Network End Segmentation Descriptor is encountered. The blackout will be lifted when the Network Start Segmentation Descriptor is encountered. The Network End and Network Start descriptors must contain a network ID that matches the value entered in "Network ID".
But after setting images here everything stays the same - only the black screen with no sign of those placeholders.
On your Output Group settings is a field called Input Loss Action. If you change that from EMIT_OUTPUT to PAUSE_OUTPUT you should get the desired result.
Alternately, you can enable an Input Loss Behavior in the channel's general settings (Global Configuration section) that will allow you to specify either a solid color screen or an input loss image slate, as well as the timing for how long to wait before displaying the slate image.
Regards,

AVAudioEngine, AVPlayer, AVPlayerViewController - Control Center controls becomes disabled when AVPlayerViewController plays video

I am using AVAudioEngine to play audio files and AVPlayer and AVPlayerViewController to play videos.
and Control Center notification are enabled UIApplication.shared.beginReceivingRemoteControlEvents()
Control Center works perfectly for audio files (play/pause/next/prev/slider) if no video file is played (if no AVPlayerViewController instance exists)
but as soon as I play a video file and then dismiss the AVPlayerViewController and play audio file, all the controls in the Control Center becomes disable.
refreshing nowPlayingInfo does not work - it only updates the thumbnail and audio title
After dismissing AVPlayerViewController

ionic 2 - detect shake device when app in background mode

I want create application with ionic 2 that it send sms when user shaked mobile and so my app must be in background mode
I search and find this plugin for set app to background
https://github.com/katzer/cordova-plugin-background-mode
but how detect shake device when use this plugin ?
I have never worked with the background-plugin, but if it lets you run the app indefinitely in the background, you should be able to use the shake plugin to detect shakes: https://ionicframework.com/docs/native/shake/
Try to add
const watch = this.shake.startWatch(60).subscribe(() => {
// do something
});
to your app.component.ts and see if it works.

QT 5.6 QWebEngine doesn't save cookies

I'am creating easy QT application named "webengine"
pWebView = new QWebEngineView(this);
pWebView->load(QUrl("http://technoz.ru"));
pWebView->show();
// On application close
delete pWebView;
The application creates a standard folder named "webengine" for storage and cookies. Domain sets a cookie for 24 hours. But after closing and opening the application again, the cookies lost. Сookies file created in the folder "webengine" - empty(I check it in sqlbrowser). But, if you hold on page 30 - 40 seconds, cookies are saved.
Why cookies are not saved immediately, and how to save them immediately?
During testing, it turned out that the QT(chromium) automatically stores the cookies through the browser in 30 seconds(constant) if the elapsed time is less, cookies are not saved. Is it possible to change this time? I tried to use the flag - --profiling-flush=5, but it does not help.
Given that the browser must preserve storage(cookies) when you close the browser, but it does not, whether it is a bug QT?
I can build QT from source, аnd find and change this setting in source, i think, but, perhaps this problem have other solution...
Thanks for all, found it bug:
https://bugreports.qt.io/browse/QTBUG-52121
You have to edit the cookie storage policy of your QWebEngineProfile. If you are using the default profile, use:
QWebEngineProfile::defaultProfile()->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies)
Both session and persistent cookies are saved to and restored from disk. You can select the folder in which you will save the cookies and cache data:
QWebEngineProfile* defaultProfile = QWebEngineProfile::defaultProfile();
defaultProfile->setCachePath("your folder");
defaultProfile->setPersistentStoragePath("your folder");

Google Glass Timeline notifications for In built actions and custom actions are not working after updation(of XE-16 glass update)

We have developed a google glass ware(timeline based) app. In that first we will send some timeline cards to the glass with some inbuilt menu items and custom menu items.
and we have configured the proxy url for getting notifications for time line.
It worked fine for so many days.
But After Google Glass XE-16 update we are not getting the timeline notifications
Can you please guide us inresolving the issue.
Hi Prisoner,
for inserting timeline we have used the following code:
global $base_url="http:\/\/mysite.com\/mirror";
$client = get_google_api_client();
$client->setAccessToken(get_credentials($_SESSION['userid'])); // A glass service for interacting with the Mirror API
$mirror_service = new Google_MirrorService($client);
$new_timeline_item = new Google_TimelineItem();
$new_timeline_item->setText('Hey I am testing new');
$notification = new Google_NotificationConfig();
$notification->setLevel("DEFAULT");
$new_timeline_item->setNotification($notification);
$menu_items = array();
$custom_menu_item = new Google_MenuItem();
$custom_menu_value = new Google_MenuValue();
$custom_menu_value->setDisplayName("Add Item");
$custom_menu_value->setIconUrl( $base_url . "/static/images/tulip.jpg");
$custom_menu_item->setValues(array($custom_menu_value));
$custom_menu_item->setAction("CUSTOM");
$custom_menu_item->setId("add_to_cart_item"); // This is how you identify it on the notification ping
array_push($menu_items, $custom_menu_item);
$new_timeline_item->setMenuItems($menu_items);
insert_timeline_item($mirror_service, $new_timeline_item, "image/jpeg", file_get_contents($base_url . "/static/images/tulip.jpg"));
for this we are trying to add new custom menus and built in menus like (pin,delete,share,send)
To subscribe to notifications we have used the Google glass Php mirror api function.
subscribe_to_notifications($mirror_service, "timeline", $_SESSION['userid'], $base_url . "/notify.php");
All these are working fine before XE-16 version update. After updation we are not able to get notification for time line card notifications
This is a known issue with sending image attachments. See details here:
https://code.google.com/p/google-glass-api/issues/detail?id=491
So the part of your code that has to change is:
insert_timeline_item($mirror_service, $new_timeline_item, "image/jpeg", file_get_contents($base_url . "/static/images/tulip.jpg"));
Needs to change to:
insert_timeline_item($mirror_service, $new_timeline_item, null, null);
And use setHTML instead of setText and include an img element with a src tag that points to a web URL. E.g.:
<img src="http://example.com/static/images/tulip.jpg" />
Note that you also have to factory reset your Glass. You can tell if you have the problem by trying to run a menu command and the spinning double arrow in the bottom right corner gets stuck and an a crash stack trace is visible on ADB logcat output on the Glass. So to fix the problem, first you have to not use image attachments, and second you have to reset the Glass to fix the broken timeline sync on the Glass.