0

Im new to swift but i like it more than obj-c as it looks a bit like java does to me from syntax wise compared to obj-c.

My problem is now that most of the source code samples are for obj-c so theyre unreadable for me =)

Anyway i managed to run a few code snippets like this(im not at my mac but they were similar):

    let steamingURL:NSURL = NSURL(string: "http://....")!
    let player = AVPlayer(URL: steamingURL)
    player.allowsExternalPlayback = false

    PlayWorkoutViewController.playerController = AVPlayerViewController()
    PlayWorkoutViewController.playerController.player = player
  self.addChildViewController(PlayWorkoutViewController.playerController)
    self.view.addSubview(PlayWorkoutViewController.playerController.view)
    PlayWorkoutViewController.playerController.view.frame = videoContainerView.frame
    PlayWorkoutViewController.playerController.showsPlaybackControls = false
    player.play()

resulting in a Play Button with a line trough it, it doesnt play the Stream. The stream source is a mpg1/2 stream according to VLCPlayer and its coming from a Linux based satellite receiver.

Another thing i tried was to change that "string:" part to "fileURLWithPath:" at the NSURL variable but that didnt work either.

Is there a way to Buffer the stream or is this just a codec issue, what workaround options do i have?

Im hesitating since three days, i hope its not a duplicate question, thanks.

EDIT: content of the stream.m3u file:

EXTM3U

EXTVLCOPT--http-reconnect=true 192.168.178.20:8001/1:0:1:445D:453:1:C00000:0:0:0:

Community
  • 1
  • 1
kaya
  • 1,626
  • 1
  • 21
  • 27
  • See this http://stackoverflow.com/a/25933122/790842 – iphonic Jul 27 '16 at 07:19
  • tried all, works with the embedded "big_buck_bunny.mp4" resource, but streaming from my device does not EDIT: the code snippets i referred are from that thread =) – kaya Jul 27 '16 at 07:20
  • Code is correct it works for me, doubting the url. – iphonic Jul 27 '16 at 07:24
  • the stream.m3u content: #EXTM3U #EXTVLCOPT--http-reconnect=true http://192.168.178.20:8001/1:0:1:445D:453:1:C00000:0:0:0: – kaya Jul 27 '16 at 07:27
  • If it is of any help, i can open the port and redirect the stream outside but i think its not wise to post the IP Address in public O.O – kaya Jul 27 '16 at 07:36
  • Read this https://developer.apple.com/streaming/ you will get help.. remove your url. – iphonic Jul 27 '16 at 07:43
  • the URL i posted is a local one, so no problem so far =) i also know of that link, if you are about the 10 minute restriction, then i must ask how the IP Camera implementations do work, as far as i know they are also continuous mpg streams Look what i also found while googleing for that #EXTVCOPT tag https://forums.developer.apple.com/thread/20114 – kaya Jul 27 '16 at 07:50

1 Answers1

0

Security setting might be the problem. Go to info.plist and Add "App Transport Security Settings". Under that add "Allow Arbitrary Loads" and set it to YES. I hope this fixes the problem.