Scenario
I'm building an iOS application in Swift. One feature is to have a live video feed as the application background. The video feed is originating from a Raspberry Pi on a local network using sudo motion
. Motion is successfully hosting the feed on default port 8081
.
The Swift app has a WKWebView
object with the source pointing to my Raspberry Pi's motion port.
Suspected Issue
The webpage at port 8081
is constantly refreshing to load the most recent frame from the camera.
Problem
When running the app, the feed connects successfully and loads the first frame, and occasionally a second but then cuts off.
On a few occasions I received the following error in the terminal: [ProcessSuspension] 0x282022a80 - ProcessAssertion() Unable to acquire assertion for process with PID 0
leading me to believe that it is a memory management issue related to the constantly refreshing nature of the webpage.
Current Configuration
Currently, my call to .load() the WKWebView
object is in ViewController.swift
> override func viewDidLoad()
.
Proposed Resolution
Do I need to build some form of loop structure where I load a frame, pause execution and then call the WKWebView
to reload a new frame a few seconds later.
I'm very new to Swift so patience with my question format is highly appreciated.