MglSaRu
MglSaRu

Reputation: 173

AVPlayer for server live content not working without extension

Thanks for taking your time to help others.

Problem description:

I would like to play LIVE content from server link, without an extension in native SwiftUI player. Server link follows this pattern:

http://****flix.com:8080/username/password/channel

I can't play an IPTV server link on SwiftUI

What I have checked?

Simple implementation of AVPlayer with link. (Not real data as involves credentials)

import SwiftUI
import AVKit

struct ContentView: View {
    let liveContentOK = URL(string: "https://ztnr.rtve.es/ztnr/1688877.m3u8")!
    let liveContentNotWorking = URL(string: "http://****flix.com:8080/username/password/channel")!

    var body: some View {
        VideoPlayer(player: AVPlayer(url: liveContent))
    }
}

#Preview {
    ContentView()
}

As well, I tried on this VLC implementation, and it works with my IPTV link. BUT, the idea was to include this on a companies App so license is not valid. That's why I want to use something native, as AVPlayer.

In this repo you can find m3u8 links that currently works on AVPlayer too. But those are the easy ones, no authentication, has extension, etc.

Just in case, I also did tried to play the link appending .m3u8 and .ts extensions, with no result.

A comparison working - not working

So, this link does NOT work: http://****flix.com:8080/username/password/channel

And this other link do work: https://ztnr.rtve.es/ztnr/1688877.m3u8

Differences I see?

Questions

  1. Why is AVPlayer not able to play content? Do I have to handle decoding?
  2. Is the port 8080 important? Should I attend that separately on AVPlayer?
  3. Do I have to handle authentication? How?

Upvotes: 0

Views: 113

Answers (0)

Related Questions