Post not yet marked as solved
I am doing CMAF/HLS video streaming on AVPlayer. The player downloads the future .ts/.cmfv chunks during buffering, but after a certain number of downloads, if I seek back to the start, it redownloads the chunks, which is unlike the web where all the chunks are taken from the cache due to bigger cache size. How do I increase the buffer size so that I can cache the entire video, the size of which is around 90-100MB?
I tried using the oft-mentioned preferredForwardBufferedDuration property, but it just changes the number of chunk calls for the future, but if I get back to the start after a long enough playback time, it re-downloads the stream chunks all the same.
Post not yet marked as solved
The Context
I'm using the HTML video element to play HLS+Fairplay streams (VOD and live) in Safari. My application is a Netflix-like. You can watch a video, stop, and watch another one. Concretly, the <video> tag is created upon each play and destroyed when the player exits.
The Problem
Sometimes, after exiting the player, launching a new video causes a MEDIA_ERR_DECODE error without anymore explanation. I can trace in my code that the Fairplay certificate and the CKC have been correctly retrieved and that the media session has been created and updated (with the CKC). In fact, when I log everything, I see the exact same logs as when it works. Except the final MEDIA_ERR_DECODE error.
When I get this error, if I immediately retry to play, the same error happens, but if I wait about 5~10 seconds, it successfully plays. It's like some resource is waiting to be garbage-collected.
What I tried
I tried playing non-DRMed videos and it works perfectly: I could play, stop, play, etc. without any issue.
So my guess is something is happening at the EME level.
I've browsed the whole Internet (twice) and couldn't come up with a clear explanation. Most of the hints I found couldn't explain my issue (e.g. bad DRM-encryption, but how could it work the first time?) or solve it (e.g. videoElement.src = "").
I'm throwing a bottle into the sea, here... Thanks for your help!
Post not yet marked as solved
Issue:
I am supporting an iOS application that streams Fairplay DRM protected content.
On iOS 16 devices, I am seeing intermittent exceptions thrown when trying to process the CKC returned by the license server.
The thrown exception is as follows:
-[AVContentKeyRequest processContentKeyResponse:] AVContentKeySession's keySystem is not same as that of keyResponse
This issue does not occur on older devices (we support iOS 13, 14, 15)
I am unable to find documentation about this error so any insight is appreciated:
High-Level Code Overview
Use ContentKeyRequest to request an application certificate
Use returned Cert to call makeStreamingContentKeyRequestData
Use returned data to request FairPlay license
Use returned CKC to generate AVContentKeyResponse (i.e. AVContentKeyResponse(fairPlayStreamingKeyResponseData:_))
Call processContentKeyResponse(_)
App crash/exception thrown when callling processContentKeyResponse
I am seeing other issues related to DRM and iOS 16 but these are specific to downloaded and offline content which do not match my use case.
Post not yet marked as solved
I'm using an .m3u8 file uploaded to Amazon Web Services for HLS streaming. When I create an HLS report for it, it shows that there are several must fix issues present.
I'm fairly new to validating and segmenting videos and such so I need to go by what's available in terms of documentation online but there's very little help or resources online that explain how to resolve these issues.
My current approach is using FFMpeg in order to encode videos and use mediafilesegmenter to divide them into .ts files and then use variantplaylistcreator to make a master playlist .m3u8 file. If someone could look at the attached image and tell me how I could possibly fix these problems with the tools I have then that would be very helpful.
Post not yet marked as solved
Currently the latest HLS Streaming Tools - mediastreamvalidator fails to run on the latest MacOS (Ventura) throwing a trace trap with exit code 133.
% sudo mediastreamvalidator -i https://demo.unified-streaming.com/k8s/live/scte35.isml/.m3u8
Password:
mediastreamvalidator: mediastreamvalidator: Version 1.17 (593.5-220531)
Validate https://demo.unified-streaming.com/k8s/live/scte35.isml/.m3u8, fetch http
[/k8s/live/scte35.isml/.m3u8] Started root playlist download
[scte35-audio_eng=64000-video=500000.m3u8] Started media playlist download
[scte35-audio_eng=64000.m3u8] Started media playlist download
[scte35-audio_eng=128000-video=1000000.m3u8] Started media playlist download
[keyframes/scte35-video=500000.m3u8] Started media playlist download
[scte35-audio_eng=128000.m3u8] Started media playlist download
zsh: trace trap sudo mediastreamvalidator -i
?133 ~
% system_profiler SPSoftwareDataType SPHardwareDataType
Software:
System Software Overview:
System Version: macOS 13.0 (22A380)
Kernel Version: Darwin 22.1.0
Boot Volume: Macintosh HD
Boot Mode: Normal
Computer Name: usp-mbp
User Name: Jamie Fletcher (jamie)
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
Time since boot: 8 minutes, 30 seconds
Hardware:
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: MacBookPro18,4
Model Number: Z15G00146N/A
Chip: Apple M1 Max
Total Number of Cores: 10 (8 performance and 2 efficiency)
Memory: 32 GB
System Firmware Version: 8419.41.10
OS Loader Version: 8419.41.10
Serial Number (system): ***************
Hardware UUID: 7264D2D7-B421-5372-B972-5FA81FB7A919
Provisioning UDID: 00006001-000A70283E02801E
Activation Lock Status: Enabled
√ ~
% curl https://demo.unified-streaming.com/k8s/live/scte35.isml/.m3u8
#EXTM3U
#EXT-X-VERSION:4
## Created with Unified Streaming Platform (version=1.11.20-26889)
# AUDIO groups
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-aacl-64",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="1"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-aacl-128",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="1"
# variants
#EXT-X-STREAM-INF:BANDWIDTH=658000,AVERAGE-BANDWIDTH=598000,CODECS="mp4a.40.2,avc1.42C01F",RESOLUTION=1280x720,FRAME-RATE=25,AUDIO="audio-aacl-64",CLOSED-CAPTIONS=NONE
scte35-audio_eng=64000-video=500000.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1316000,AVERAGE-BANDWIDTH=1196000,CODECS="mp4a.40.2,avc1.42C01F",RESOLUTION=1280x720,FRAME-RATE=25,AUDIO="audio-aacl-128",CLOSED-CAPTIONS=NONE
scte35-audio_eng=128000-video=1000000.m3u8
# variants
#EXT-X-STREAM-INF:BANDWIDTH=75000,AVERAGE-BANDWIDTH=68000,CODECS="mp4a.40.2",AUDIO="audio-aacl-64"
scte35-audio_eng=64000.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=150000,AVERAGE-BANDWIDTH=136000,CODECS="mp4a.40.2",AUDIO="audio-aacl-128"
scte35-audio_eng=128000.m3u8
# keyframes
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=73000,CODECS="avc1.42C01F",RESOLUTION=1280x720,URI="keyframes/scte35-video=500000.m3u8
Post not yet marked as solved
I'm trying to download HLS assets using AVAggregateAssetDownloadTask.
It's pretty stable on iOS < 16.0.
But after updating to iOS 16 I'm getting randomly following error:
Task <DB57343C-5D3A-4500-A886-A30FD16AD2C3>.<3> finished with error [-12640] Error Domain=CoreMediaErrorDomain Code=-12640 "(null)" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(
"BackgroundAVAssetDownloadTask <DB57343C-5D3A-4500-A886-A30FD16AD2C3>.<3>"
), _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundAVAssetDownloadTask <DB57343C-5D3A-4500-A886-A30FD16AD2C3>.<3>}
Few retry attempts usually solve the issue.
I have compared requests made by the app using proxy server and .m3u8 playlist does not differ between successful and failed download attempts.
This is the network traffic when download fails.
It stops on ...Audio_Selector.m3u8 playlist.
And this is the network traffic when download successfully continues:
Thanks!
Post not yet marked as solved
Hi, I wanna test playing ll-hls in simulator, my devices and other tester's devices.
the key 'com.apple.developer.coremedia.hls.low-latency', introduced at https://developer.apple.com/videos/play/wwdc2019/502, was disabled in XCode. Thus I can't add this key to my entitlement.
But This capabilities table, (https://developer.apple.com/help/account/reference/supported-capabilities-ios/), said ADP only can add 'Low Latency HLS' to App ID Configuration. I've also checked I can add this capability in my ADP memberships and my App page.
Is it possible to play ll-hls only for apps that have been checked 'Low Latency HLS' Capability and distributed to AppStore or TestFlights?
If I run directly by xcode to my device, I can't play ll-hls?
I couldn't find any documentations about 'Low Latency HLS' Capability and its affect.
Post not yet marked as solved
When WKWebView uses getUserMedia, the following authorization prompt will pop up every time you exit the app (as shown below). How to solve this problem? thank you.(https://obs-ogt.obs.cn-east-3.myhuaweicloud.com:443/tinymce/1672364537956-%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20221230094106.png)
Post not yet marked as solved
Is there any way of accessing truedepth camera of iPhones on the browser and use it
Post not yet marked as solved
App crashing while playing HLS video. Some users reported that it happens randomly, but we have not found this issue yet or how exactly this happens.
It would be really helpful if we get some insights on this, as this is the only major issue faced right now. Please help us.
Details found on crashlytics --
Crashed: com.apple.root.default-qos
0 PhysicsWallah 0x233d38 sendRequest + 4379770168 (AVPlayerReverseProxy.swift:4379770168)
1 PhysicsWallah 0x233124 + 43 (AVPlayerReverseProxy.swift:43)
2 PhysicsWallah 0x233184 + 4379767172 (:4379767172)
3 GCDWebServer 0xb474 __79-[GCDWebServer(Handlers) addDefaultHandlerForMethod:requestClass:processBlock:]_block_invoke + 874 (GCDWebServer.m:874)
4 GCDWebServer 0x10438 -[GCDWebServerConnection(Subclassing) processRequest:completion:] + 758 (GCDWebServerConnection.m:758)
5 GCDWebServer 0xd330 -[GCDWebServerConnection _startProcessingRequest] + 148 (GCDWebServerConnection.m:148)
6 GCDWebServer 0xe348 __45-[GCDWebServerConnection _readRequestHeaders]_block_invoke + 342 (GCDWebServerConnection.m:342)
7 GCDWebServer 0xedb0 __64-[GCDWebServerConnection(Read) readHeaders:withCompletionBlock:]_block_invoke + 457 (GCDWebServerConnection.m:457)
8 GCDWebServer 0xeae4 __68-[GCDWebServerConnection(Read) readData:withLength:completionBlock:]_block_invoke + 428 (GCDWebServerConnection.m:428)
9 libdispatch.dylib 0x2c9b4 __dispatch_read$VARIANT$mp_block_invoke_2.31 + 52
10 libdispatch.dylib 0x63094 _dispatch_call_block_and_release + 24
11 libdispatch.dylib 0x64094 _dispatch_client_callout + 16
12 libdispatch.dylib 0x13cbc _dispatch_root_queue_drain + 636
13 libdispatch.dylib 0x1439c _dispatch_worker_thread2 + 172
14 libsystem_pthread.dylib 0x1dd4 _pthread_wqthread + 224
15 libsystem_pthread.dylib 0x193c start_wqthread + 8
Post not yet marked as solved
I would like to perform pathway cloning as described in the video Deliver reliable streams with HLS Content Steering and the document draft-pantos-hls-rfc8216bis-12. Unfortunately, I keep getting an error:
CoreMediaErrorDomain (Code: -15881): Content Steering: error in handling Steering Manifest, ignoring and continue playback.
The client device is an iPhone (iOS 16.2). There is a video accessible from an "azure" CDN and a video accessible from an "edge" CDN. I want the player, which is playing the video from the azure CDN, to switch to the edge CDN.
This is the manifest received by the player:
#EXTM3U
#EXT-X-CONTENT-STEERING:SERVER-URI="https://example.com/content-steering?pathwaycloning=true",PATHWAY-ID="azure"
#EXT-X-STREAM-INF:BANDWIDTH=5605600,RESOLUTION=416x240,CODECS="avc1.64001e,mp4a.40.2",PATHWAY-ID="azure"
https://azure.com/contentsteering/stream_0/stream.m3u8
This is the steering manifest received by the player (every 10s, as specified by TTL):
{
"VERSION": 1,
"TTL": 10,
"RELOAD-URI": "https://example.com/content-steering?pathwaycloning=true",
"PATHWAY-PRIORITY": [
"edge",
"azure",
"aws"
],
"PATHWAY-CLONES": [
{
"BASE-ID": "azure",
"ID": "edge",
"URI-REPLACEMENT": {
"HOST": "edge.com"
}
}
]
}
I would expect the player to request the media files (stream.m3u8, data00.ts, data01.ts...) at https://edge.com/contentsteering/stream_0/. It doesn't, however, and instead I get the error specified in bold above.
Any idea what is wrong with my steering manifest?
Post not yet marked as solved
We are running into an issue that seems unique to AVPlayer. We've built a new architecture for our HLS streams which makes use of relative URLs. We can play these channels on a number of other players just fine, but when trying to build using AVPlayer, the channel gets 400 errors requesting either child manifests/segments with relative URLs.
Using curl, we are able to get a 200 success by getting to a url like: something.com/segmentfolder/../../abcd1234/videosegment_01.mp4
Curl is smart enough to get rid of the ../../ and create a valid path so the actual request (which can be seen using curl -v) looks something like:
something.com/abcd1234/videosegment_01.mp4
Great. But AVPlayer doesn't do this. So it makes the request as is, which leads to a 400 error and it can't download the segment. We were able to simulate this problem with Swift playground fairly easily with this code:
let hlsurl = URL(string: "website.com/segmentfolder/../../abc1234/videosegment.mp4")!
print(hlsurl)
print(hlsurl.standardized)
The first print shows the URL as is. Trying to GET that URL leads to a 400. The second print properly handles it by adding .standardized to the URL. This leads to a 200. The problem is, this only works for the top level/initial manifest, it doesn't work for all the child manifests and segments.
let url = URL(string: "website.com/segmentfolder/../../abc1234/videosegment.mp4")!
let task = URLSession.shared.dataTask(with: url.standardized) {(data, response, error) in
guard let data = data else { return }
print(String(data: data, encoding: .utf8)!)
}
So question, does AVPlayer support relative URLs? If so, why can't it handle the ../../ in the URL path like other players and curl can? Is there a special way to get it to trigger standardizing ALL URL requests?
Any help would be appreciated.
n the network log.n the network log.
Post not yet marked as solved
upgrade iOS to 16 from 15/15.1/15.2/15.3/15.4/15.6
our app on some devices upgraded to iOS version over 16 RTP player can't receive RTP stream data from the server, but this situation is not observed on the iOS version below 16. This issue is probabilistic, not all devices get this issue.
Post not yet marked as solved
There's a same question already there . posting it again .
Hi. We have a custom player and would like to implement trick play(show preview thumbnail of the content as user scrubs on the slider). Stream format is .m3u8 and the manifest does have "EXT-X-I-FRAME-STREAM-INF" tag mentioned in specification. But we are clueless about how to utilise it and show thumbnail above the slider. Looking forward to the help.
Thank you.
I have achieved it using sprite image and cropping and showing it above the slider but I would like to opt for the recommended way by apple . Please help if anyone have implemented trick play in custom AVPlayer
Brightcove iOS sdk has done it would like to know how they achieve it .
https://github.com/brightcove/brightcove-player-sdk-ios (section - Thumbnail Seeking
)
Post not yet marked as solved
Hi. I have unresolved problem with playback HLS. Everything double checked according to https://developer.apple.com/documentation/http_live_streaming/http_live_streaming_hls_authoring_specification_for_apple_devices?language=objc
Maybe i missed something? Can any one help?
Link to one of my HLS - https://drive.google.com/file/d/1TPwYg8QkbUyLYFNwAG6jU4X_jbS9fp0j/view?usp=sharing
Post not yet marked as solved
We've received reports from users with iPhone 14 pro models that their phones are crashing and turning off entirely when viewing live streams in our app.
These streams have been working since iOS 10. I've filed a bug report through the feedback assistant (FB11839509) and have still heard nothing back.
Post not yet marked as solved
Hi,
as stated in this radar https://feedbackassistant.apple.com/feedback/11601970, our customers are facing issues after having upgraded to iOS 16 casting video from our app to their TV using HDMI Adaptor.
HDMI casting is ok using clear (non Fairplay) video content but not with HLS Fairplay.
The sound is broken and playback freezes a lot.
The same problem happens on iOS 16 beta 1 as well.
As far as I've seen there is no AVFoundation API update for iOS 16 listed in the release note.
Anyone else experiencing this issue ?
Best regards
Cédric
Post not yet marked as solved
What is the first version of iOS to support pathway cloning as part of content steering? Is it supported in safari browsers via the html video tag?
I can switch between pathways defined in the manifest file, but when I try to clone a pathway and introduce a new pathway id my stream stops.
Post not yet marked as solved
Hello,
I have a strange issue when deleting partially downloaded HLS streams. I'm using the HLSCatalog sample as a reference and the code is confusing.
Here's a snippet:
/// Tells the delegate that the task finished transferring data.
func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
let userDefaults = UserDefaults.standard
/*
This is the ideal place to begin downloading additional media selections
once the asset itself has finished downloading.
*/
guard let task = task as? AVAggregateAssetDownloadTask,
let asset = activeDownloadsMap.removeValue(forKey: task) else { return }
guard let downloadURL = willDownloadToUrlMap.removeValue(forKey: task) else { return }
// Prepare the basic userInfo dictionary that will be posted as part of our notification.
var userInfo = [String: Any]()
userInfo[Asset.Keys.name] = asset.stream.name
if let error = error as NSError? {
switch (error.domain, error.code) {
case (NSURLErrorDomain, NSURLErrorCancelled):
/*
This task was canceled, you should perform cleanup using the
URL saved from AVAssetDownloadDelegate.urlSession(_:assetDownloadTask:didFinishDownloadingTo:).
*/
guard let localFileLocation = localAssetForStream(withName: asset.stream.name)?.urlAsset.url else { return }
do {
try FileManager.default.removeItem(at: localFileLocation)
userDefaults.removeObject(forKey: asset.stream.name)
} catch {
print("An error occured trying to delete the contents on disk for \(asset.stream.name): \(error)")
}
userInfo[Asset.Keys.downloadState] = Asset.DownloadState.notDownloaded.rawValue
case (NSURLErrorDomain, NSURLErrorUnknown):
fatalError("Downloading HLS streams is not supported in the simulator.")
default:
fatalError("An unexpected error occured \(error.domain)")
}
} else {
do {
let bookmark = try downloadURL.bookmarkData()
userDefaults.set(bookmark, forKey: asset.stream.name)
} catch {
print("Failed to create bookmarkData for download URL.")
}
userInfo[Asset.Keys.downloadState] = Asset.DownloadState.downloaded.rawValue
userInfo[Asset.Keys.downloadSelectionDisplayName] = ""
}
NotificationCenter.default.post(name: .AssetDownloadStateChanged, object: nil, userInfo: userInfo)
}
If the task completes, we generate a bookmark:
let bookmark = try downloadURL.bookmarkData()
and we save it.
if I was to delete the stream then, it all works fine. I can go to my device's settings and I can't see it iPhone Storage. So all good.
However.... if I try to cancel the download
task?.cancel()
Is invoked and the didCompleteWithError function is called with a cancellation error. At this point, we haven't generated a bookmark for the file, so this will always fail
guard let localFileLocation = localAssetForStream(withName: asset.stream.name)?.urlAsset.url else { return }
do {
try FileManager.default.removeItem(at: localFileLocation)
But strangely, even if I try to generate a bookmark from the url location where the asset, I will get a bookmark, FileManager won't throw any errors on delete, but the partial download still remains on the device.
let url = try URL(resolvingBookmarkData: localFileLocation,
bookmarkDataIsStale: &bookmarkDataIsStale)
try FileManager.default.removeItem(at: url)
Any ideas?
Post not yet marked as solved
Hi everyone,
I am having a problem on AVPlayer when I try to play some videos.
The video starts for a few seconds, but immediately after I see a black screen and in the console there is the following error:
https://...manifest.m3u8 -12642 "CoreMediaErrorDomain" "Impossibile completare l'operazione. (Errore CoreMediaErrorDomain -12642 - No matching mediaFile found from playlist)"
-12880 "CoreMediaErrorDomain" "Can not proceed after removing variants" -
The strange thing is that if I try to play the same video on multiple devices, the result is that on someone it works and on someone it does not. For example on iPhone 5SE works and on iPad Pro 11'' II gen. and iPhone11
I've tried searching around to figure out what may be causing the problem, but there doesn't seem to be a clear solution.
Anyone who has had a similar problem? Do you have any ideas about the reason for this problem?