Post not yet marked as solved
Hi,It seems like it's pretty easy to consume HTTP Live Streaming content in an iOS app. Unfortunately, I need to consume media from an RTSP server. It seems to me that this is a very similar thing, and that all of the underpinnings for doing it ought to be present in iOS, but I'm having a devil of a time figuring out how to make it work without doing a lot of programming.For starters, I know that there are web-based services that can consume an RTSP stream and rebroadcast it as an HTTP Live Stream that can be easily consumed by the media players in iOS. This won't work for me because my application needs to function in an environment where there is no internet access (it's on a private Wifi network where the only other thing on the network is the device that is serving the RTSP stream).Having read everything I can get my hands on and exploring third-party and open-source solutions, I've compiled the following list of ideas:1. Using an iOS build of the open-source ffmpeg library, which supports RTSP, I've come up with a test app that can receive the RTSP packets, decode them, create UIImages out of the frames, and display those frames on-screen. This provides a crude player, but performance is poor, most likely because ffmpeg can't take advantage of any hardware acceleration. It also doesn't provide me with any way to integrate the video stream into AVFoundation, so I'm on my own as far as saving the stream to a file, transcoding it, etc.2. I know that the AVURLAsset class doesn't directly support the RTSP scheme. Since I have access to the undecoded RTSP packets via ffmpeg, I've thought it should be possible to implement RTSP support myself via a custom NSURLProtocol, essentially fooling AVFoundation into reading those packets as if they originated in a file. I'm not sure if this would work, since the raw packets coming from the RTSP server might lack the headers that would otherwise be present in data being read from a file. I'm not even sure if AVFoundation would recognize my custom protocol.3. If a protocol doesn't work, I've considered that I might be able to implement my own local HTTP Live Streaming server that converts the RTSP packets into an HTTP stream that the media players can read. This sounds like a terribly convoluted solution to the problem, at best, and very difficult at worst.4. Going back to solution (1), if I could speed up the decoding by using some iOS CoreVideo function instead of ffmpeg, this solution might be okay. However, I can't find any documentation for CoreVideo on iOS (Apple only documents it for OS X).5. I'm certainly willing to license a third-party solution if it works well and provides good performance. Unfortunately, everything I've found so far is pretty crummy and mostly just leverages ffmpeg and/or VLC. What is most disappointing to me is that nobody seems to be able or willing to provide a solution that neatly integrates with AVFoundation. I really want to make my RTSP stream available as an AVAsset so I can use it with AVFoundation players and other classes -- I don't want to build an app that relies on custom third-party code for everything.Any ideas, tips, advice would be greatly appreciated.Thanks,Frank
Post not yet marked as solved
I know that HLS supports fmp4. But I know that to use fmp4 instead of ts, you need to support CENC cbcs. If cbcs is supported on Android 7.0 or later and you do not use cbcs, can not you use fmp4?
Post not yet marked as solved
It appears that, on initialization, an AVURLAsset has a copy of the cookies from HTTPCookieStorage.shared.cookies, unless otherwise specified with the options parameter. This array of HTTPCookie is merely a copy of iOS's cookie store at the time of initialization. If the OS's cookie store updates, the player/asset does not begin to use the most up-to-date cookies, instead using its original copy. How can I go about updating the player's/asset's cookie store to the current, most up-to-date, cookie store?
Post not yet marked as solved
Seeing this error a lot while playing HTTP live stream. AVPlayer stops play when it encounters this error. I reasearched about the error but couldnt find any clue. Anyone has any recommendations or work around for this error?
Post not yet marked as solved
Hello, I have some Videos that I can play with AVPlayer but I can't Download and Play offline from my device. When I download the asset and play the asset one time then I can play offline the asset as it would have been downloaded.I use the code from apple's recommended project https://developer.apple.com/documentation/avfoundation/media_assets_playback_and_editing/using_avfoundation_to_play_and_persist_http_live_streamsBy replacing in apples project the link with my own link I experience the same result. Also in my project the other .m3u8 video that I am trying to download work fine. The main difference is that in my link URL Signing is being used.Also in apples project the video can be played but not downloaded and play.Example Link to test my download is: https://tr.vod.cdn.cosmotetvott.gr/v1/524/16/403201605073/403201605073.ism/.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4The video does not have any encryption so that's not the issue, but it might be downloading over HTTPS.When I download the Container From Devices for my app I see that I have downloaded the myVideo.movpkg file and inside that Folder I have the root.xml file, the Data folder, the boot.xml file, and only 2 folders with fragment data (In some videos only 1 folder). When I play the downloaded video with Internet connection more folders with fragments are being downloaded. And if I download all the fragment folders then the video can be played offline normally.root.xml file<?xml version="1.0" encoding="UTF-8"?>
<MoviePackage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://apple.com/IMG/Schemas/MoviePackage" xsi:schemaLocation="http://apple.com/IMG/Schemas/MoviePackage /System/Library/Schemas/MoviePackage.xsd">
<Version>1.0</Version>
<MoviePackageType>HLS</MoviePackageType>
<BootImage>boot.xml</BootImage>
</MoviePackage>boot.xml file <?xml version="1.0" encoding="UTF-8"?>
<HLSMoviePackage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://apple.com/IMG/Schemas/HLSMoviePackage" xsi:schemaLocation="http://apple.com/IMG/Schemas/HLSMoviePackage /System/Library/Schemas/HLSMoviePackage.xsd">
<Version>1.0</Version>
<HLSMoviePackageType>PersistedStore</HLSMoviePackageType>
<Streams><Stream ID="0-ROFVRWFPBCMNXKILE7FOE4O3PNGGD2HZ-454000" Path="0-ROFVRWFPBCMNXKILE7FOE4O3PNGGD2HZ-454000" NetworkURL="https://gr-ampelokipoi-prod-cache01.vod.cdn.cosmotetvott.gr/v1/524/16/403201605073/403201605073.ism/403201605073-audio_eng=128000-video=300000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4"><Complete>YES</Complete></Stream><Stream ID="0-IZ4BCCN2TMQXA2S47ILRQOD5IPNLNK5R-454000" Path="0-IZ4BCCN2TMQXA2S47ILRQOD5IPNLNK5R-454000" NetworkURL="https://tr.vod.cdn.cosmotetvott.gr/v1/524/16/403201605073/403201605073.ism/403201605073-audio_eng=128000-video=300000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4"><Complete>NO</Complete></Stream></Streams>
<MasterPlaylist><NetworkURL>https://tr.vod.cdn.cosmotetvott.gr/v1/524/16/403201605073/403201605073.ism/.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4</NetworkURL></MasterPlaylist><DataItems Directory="Data"><DataItem><ID>65E586E6-53C7-4750-A5B7-55416C783867</ID><Category>Playlist</Category><Name>master.m3u8</Name><DataPath>Playlist-master.m3u8-65E586E6-53C7-4750-A5B7-55416C783867.data</DataPath><Role>Master</Role></DataItem></DataItems></HLSMoviePackage>Inside Data folder Playlist-master.m3u8-65...67.data file#EXTM3U
#EXT-X-VERSION:1
## Created with Unified Streaming Platform (version=1.10.12-18737)
# variants
#EXT-X-STREAM-INF:BANDWIDTH=454000,CODECS="mp4a.40.2,avc1.77.30",RESOLUTION=424x240,FRAME-RATE=25
403201605073-audio_eng=128000-video=300000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4
#EXT-X-STREAM-INF:BANDWIDTH=878000,CODECS="mp4a.40.2,avc1.77.30",RESOLUTION=640x360,FRAME-RATE=25
403201605073-audio_eng=128000-video=700000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4
#EXT-X-STREAM-INF:BANDWIDTH=1726000,CODECS="mp4a.40.2,avc1.77.31",RESOLUTION=1024x576,FRAME-RATE=25
403201605073-audio_eng=128000-video=1500000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4
#EXT-X-STREAM-INF:BANDWIDTH=3952000,CODECS="mp4a.40.2,avc1.77.31",RESOLUTION=1280x720,FRAME-RATE=25
403201605073-audio_eng=128000-video=3600000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4
#EXT-X-STREAM-INF:BANDWIDTH=7026000,CODECS="mp4a.40.2,avc1.77.40",RESOLUTION=1920x1080,FRAME-RATE=25
403201605073-audio_eng=128000-video=6500000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4
# variants
#EXT-X-STREAM-INF:BANDWIDTH=136000,CODECS="mp4a.40.2"
403201605073-audio_eng=128000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4
b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4My question is what's wrong, is it a client issue or something must change from back-end?
Post not yet marked as solved
AVPlayer gets the list of URLs from the m3u8 file. I need to add some query string at the end of each URL.
Is there any option in the AVPlayer to do this?
Example:
HLS URL : http://example.com/hls.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10.417000,ts
#EXTINF:10.417000,ts
#EXTINF:9.470000,ts
#EXTINF:10.417000,ts
#EXTINF:9.470000,ts
#EXTINF:10.417000,ts
#EXTINF:9.470000,ts
#EXTINF:3.840611,ts
#EXT-X-ENDLIST
AVPlayer is trying to download http://example.com/1.ts
But I want the AVPlayer to add
"?st=2020-09-01T13%3A59%3A03Z&se=2020-09-02T13%3A59%3A03Z&sp=rl&sv=2018-03-28&sr=b&sig=Pua9sv8mgvPF6gNwuBSghdEq%2BefMFmwBuyUdjCetmw4%3D"
So AVPlayer will try
http://example.com/1.ts?st=2020-09-01T13%3A59%3A03Z&se=2020-09-02T13%3A59%3A03Z&sp=rl&sv=2018-03-28&sr=b&sig=Pua9sv8mgvPF6gNwuBSghdEq%2BefMFmwBuyUdjCetmw4%3D instead of http://example.com/1.ts
Post not yet marked as solved
Does AppleTV 4K support HLG in any configuration? When I connect my AppleTV 4K to a Samsung TV with HLG support via HDMI
AVPlayer.availableHDRModes.contains(.hlg) returns false
However
AVPlayer.availableHDRModes.contains(.hdr10) returns true
https://support.apple.com/en-us/HT208074 only mentions HDR10 and Dolby Vision support.
Is there any way to play HLG video on AppleTV 4K similar to how it works on newer iPhones and iPads?
Post not yet marked as solved
Hi
I wish to know where I can find documentation / sdk to user widevine and / or Fairplay in our application.
Is there any examples of using it in AVPlayer?
Thank you very much for any help.
Post not yet marked as solved
I have a live presentation where the encoder was not sending data for different times for audio and video. For example:
Audio: 1, 2, 3, -, -, 6, -, -, 9
Video: 1, 2, 3, -, -, -, -, -, 9
Should the packager emit 2 discontinuity tags for audio or just discard timestamp 6 and merge them into 1 discontinuity?
Section 8.15 of the HLS authoring spec says:
"All variants and renditions MUST have discontinuities at the same points in time."
Does this mean that for audio/video and text variants all need to align?
However the documentation for EXT-X-DISCONTINUITY-SEQUENCE seems to imply that a/v may not necessarily have the same count of discontinuities. Please clarify which is correct and how the packager should have emitted the discontinuity tags above.
Thanks!
Post not yet marked as solved
Hello,
I have a problem with my iOS application which displays video streaming via MobileVlcKit. this function has been available on my application for many months but, for a few days, I can't see the video stream in my application !
when I use the xCode simulator, the video stream is displayed correctly.
but, when i launch a local version or a version in testflight i get a black screen without my video stream flux !
when I run a local version via the USB cord, I see this message **** in the debugging console :
"Unable to determine our source address: This computer has an invalid IP address: 0.0.0.0"
can someone please help me?
Post not yet marked as solved
Environment:
HLS Playback session, full segments
HEVC Segments
CMAF/fmp4
CEA-608 caption ingest using Video payload PREFIX_SEI HEVC NALUs
Safari Native HLS Player
Problem description
When playing the HLS HEVC based content on Safari, the SEI NALU embedded CC doesn't render ( although it is selectable by the Safari native player )
Analysis
For AVC based 608 muxed SEI NALUs, Safari successfully render CCs
When concatenating the Init segment and concatenating w/ the CMAF segments, the resulting file IS PLAYABLE using VLC where 608 CC is properly rendered
Having in mind "HLS Authoring Specification for Apple Devices", it is indicated that "For HDR10 video, the SEI NAL units (that is, static metadata) SHOULD be in the HEVC Configuration Box ('hvcC') and not in the individual sample data. Adding CC as SEI NALUs to the hvcC atom, didn't have any affect, CCs were still not playing...
Why can't the 608 CC play on the Native Safari HLS Player ?
For reference, here is the concatenated file:
https://drive.google.com/file/d/1NGLRtPGdQMHEO6E12DnF3cEV01ESSQm_/
Post not yet marked as solved
Hello,
My problem is quite complex, so I am going to describe it in detail below.
I am developing a playback app that makes use of HLS streaming. One of the requirements I have to meet is that my app should react to HTTP response headers. As there is no API to get these information, I applied the solution described in the latest comment right here: HTTP Response Header from AVPlayer – I am using a proxy server to extract the headers from the response.
The problem happens when a user wants to stream video on an external device via AirPlay. Since the proxy server runs only on a mobile device, any HTTP request fails on the external device due to an incorrect URL (e.g http://127.0.0.1:58244/theRestOfUrl/playlist.m3u8). In this case, I detect when the AirPlay connection is initiated (via the Notification Center mechanism), and then change AVPlayerItem by calling the replaceCurrentItem(with:) method. The new item contains a correct URL, without the proxy server address added. Everything works fine on AirPlay 2, but unfortunately not on older AirPlay – the player on the external device displays an activity indicator for a moment and after a while the connection is being interrupted. As a workaround, I tried to set nil on AVPlayer and create a new instance of it, but this does not work either.
I can attach the sample project if needed.
Best regards,
Tomasz
Post not yet marked as solved
Hello! I trying to inserting and playing a live stream inside video tag. In chrome it works perfectly, video start playing as soon as possible, but in safari I can see when live stream is available and poster was removed(autoplay was successful triggered), but until I switch between browser tabs, I see only black screen where the video should be. Also I can see my livestream if I switch between applications windows e.g. I switch to slack then back to the safari and video will playing.
During the study of the problem, I managed to find out that is not problem about webrtc (because on server I can see that live stream bytes was delivered to client), and it's not problem of html5 video tag, because autoplay (muted, of course) always triggered as expected. But this may be due to internal safari tricks with web pages, because only one thing happens when I switch between tabs/apps -- it's document.visibilityState.
How can I fix this behavior? I want to see how my stream works equally well in all browsers and now the problem I described is observed exclusively in safari
Post not yet marked as solved
I'm trying to use the sample code associated to the talk Author fragmented MPEG-4 content with AVAssetWriter which can be found here.
It works well when I run it on macOS, but after adapting it to run in iOS (basically moving the code in the main file to a view controller), it doesn't work. The problem is that the function:
assetWriter(_:didOutputSegmentData:segmentType:segmentReport:)
is never called for the last segment.
In macOS, the last segment is reported after calling the function AVAssetWriter.finishWriting(completionHandler:), but before the completionHandler parameter block is invoked. In iOS, nothing happens at that point.
Is there anything I could do from my side to fix this problem?
Thanks in advance!
Post not yet marked as solved
I have a video player application and while playing an HLS video on AVPlayer, I noticed that the muxed VTT subtitles are not showing up at the correct time.
For example, using AVPlayerItemLegibleOutput I can see that a text that was supposed to show at 24:37.107 is actually displaying at 24:36.406.
What I would like to know is if there's anything that I can do to identify why that is happening and what would cause AVPlayer to lose sync for the embedded captions.
Post not yet marked as solved
I’m developing ios app, using web technologies ( cordova/capacitor/angular ).
The app is oriented for playing video, so it’s important to give good UX and smooth playing;
When app change state from background to foreground, all loaded HLS video ‘freezes’ and shows no signs of life. This issue only related to HLS videos, in case of oridinary mp4 videos, everything work fine after state changes;
Type of used HLS - VOD;
Example m3u8:
#EXT-X-TARGETDURATION:5
#EXT-X-VERSION:7
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MAP:URI="01_1750k_part_0.mp4"
#EXTINF:4.95000,
#EXT-X-BITRATE:1839
01_1750k_part_1.m4s
#EXTINF:5.00000,
#EXT-X-BITRATE:1634
01_1750k_part_2.m4s
#EXTINF:5.05000,
#EXT-X-BITRATE:1775
01_1750k_part_3.m4s
#EXT-X-ENDLIST
Any ideas ?
Post not yet marked as solved
Hi,
We are using AVPlayer for FPL HLS stream, after migrating to iOS 15 (currently Beta 3), we have observed a strange behavior during segments download;
The player downloads last video segment of VOD HLS stream
The player downloads all audio segments
Playback starts playing from the end (last segment)
Needs to restart playback to start downloading all video segments.
Note that we do not have this behavior with older versions of iOS (14 and before).
m3u8 file
Thank you,
Post not yet marked as solved
Hello, I'd like to redirect hls playlist from server A to server B, however second server B used self-signed certificate. This requires for my customers to get proper content if main server will be banned. How can I accomplish 2 things:
add redirect header per each AVPlayerItem request?
accept self-signed certificate from server B?
Thank you in advance
Post not yet marked as solved
Hi,
I want to know the price table of using the encoding and the distribution service with HLS(HTTP LIVE STREAMING).
Please help me . I have tried searching but unable to find
Post not yet marked as solved
Hi,
I probably know how to download a hls video. But can someone tell me that if video is drm protected how do i download a video? How do i provide key to player while offline? I can't find piece of code anywhere, please can you provide me with an example of code especially how to provide key / license to player for offline playback