2

I am using the AVPlayer for playing the video. But my problem i.e, the the player is occurring the error. while the same url is already to play in to the Android device and Safari web browser also. If this url replaced by the other url it's working fine.

This is the error.

player.error==========>>>>>>>>>>Optional(Error Domain=AVFoundationErrorDomain Code=-11848 "Cannot Open" UserInfo={NSUnderlyingError=0x156d78f30 {Error Domain=NSOSStatusErrorDomain Code=-12925 "(null)"}, NSLocalizedFailureReason=The media cannot be used on this device., NSLocalizedDescription=Cannot Open})

    override func viewDidLoad() {
            super.viewDidLoad()

            // Do any additional setup after loading the view.
            let videoUrl = "http://telvuehls_t03007-i.akamaihd.net/hls/live/217085/T03007-calkins/playlist.m3u8"
            let playerItem = AVPlayerItem(URL: NSURL(string: videoUrl as String)!)
            let playerObj = AVPlayer(playerItem: playerItem)

            self.player = playerObj
            if playerItem.error == nil{
                playerObj.play()
            }else{
               print("player.error==========>>>>>>>>>>\(playerItem.error)")
            }
        }
Sankalap Yaduraj Singh
  • 1,167
  • 2
  • 14
  • 32

1 Answers1

2

Please refer the following link Supportable Formats for supportable formats of AVPlayer

I think the format you are using to play is not able to open by AVPlayer which is clearly mentioned in the error.

As for i know AVPlayer need chunk of data to play.

Community
  • 1
  • 1
Vinodh
  • 5,262
  • 4
  • 38
  • 68