Ubuntu 24.04, Connect IQ 7.4.3
After loading the .m3u8 file, the responseCallback event is triggered, where the code = 200 and date = null are transmitted.
At the same time, Viewing HTTP traffic shows that the media is being loaded. After loading the media, the responseCallback trigger does not work.
You can check with the code below
import Toybox.Communications;
import Toybox.Lang;
import Toybox.System;
import Toybox.Media;
class AbooksSyncDelegate extends Communications.SyncDelegate {
function initialize() { SyncDelegate.initialize(); }
function onStartSync() as Void {
var headers = {"Content-Type" => Communications.REQUEST_CONTENT_TYPE_URL_ENCODED};
var context = {"name" => "book title"};
var url = "https://r1.akniga.club/b/96726/pl.m3u8?res=2";
var options = {
:method => Communications.HTTP_REQUEST_METHOD_GET,
:headers => headers,
:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_HLS_DOWNLOAD,
:fileDownloadProgressCallback => self.method(:downloadProgress),
:context => context,
:mediaEncoding => Media.ENCODING_ADTS
};
var callback = self.method(:onWebResponse);
Communications.makeWebRequest(url, null, options, callback);
}
function downloadProgress(bytesTransferd, bytesSize) {
System.println("progress: " + bytesTransferd + " / " + bytesSize);
}
function onWebResponse(responseCode, data, context) {
System.println("onWebResponse: " + responseCode);
System.println(context);
System.println(data);//data = null !!!!always
Communications.notifySyncComplete(null);
}
// Called by the system to determine if the app needs to be synced.
function isSyncNeeded() as Boolean { return true; }
// Called when the user chooses to cancel an active sync.
function onStopSync() as Void {
Communications.cancelAllRequests();
Communications.notifySyncComplete(null);
}
}