Audio playback error in video streaming

Asked

Viewed 89 times

0

I’m trying to reproduce a video streaming but it’s giving audio problems. On the Android platform, I managed to play it without errors and on the web is also in a good quality.

I’ve taken several examples of projects that reproduce streaming on the internet, but all present the same error in audio when I put the link I’m using.

Because it works on other platforms, I believe there must be some problem with IOS in specific. Its extension is .m3u8.

I’m doing it this way: (Swift)

(Link mentioned in the code is the link that is giving problems only on Ios) - If you know any solution, it can be either in Swift or objective-C.

link streaming - http://d1t4ozb7rtitmv.cloudfront.net/acustica/myStream/playlist.m3u8

web link - http://www.acusticafm.com.br/video.php

import UIKit


let videoUrl = NSURL(string: "http://d1t4ozb7rtitmv.cloudfront.net/acustica/myStream/playlist.m3u8")!

class ViewControllerV: UIViewController, PlayerDelegate {

    private var player: Player!
    @IBOutlet var viewV: UIView!
    @IBOutlet var viewK: UIView!


    // MARK: object lifecycle

    convenience init() {
        self.init(nibName: nil, bundle:nil)
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }

    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
    }

    // MARK: view lifecycle

    override func viewDidLoad() {

        super.viewDidLoad()
    
        //TELA . . .
        let mode = UIInterfaceOrientation.LandscapeLeft.rawValue
        UIDevice.currentDevice().setValue(mode, forKey: "orientation")
      

        self.view.autoresizingMask = ([UIViewAutoresizing.FlexibleWidth, UIViewAutoresizing.FlexibleHeight])

        self.player = Player()
        self.player.delegate = self
        self.player.view.frame = self.view.bounds
    

        self.viewV.addSubview(self.player.view) 
        self.player.didMoveToParentViewController(self)
    
        self.player.setUrl(videoUrl)
    
        self.player.playbackLoops = true
    
        let tapGestureRecognizer: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: "handleTapGestureRecognizer:")
        tapGestureRecognizer.numberOfTapsRequired = 1
        self.player.view.addGestureRecognizer(tapGestureRecognizer)

    }



    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
    
        self.player.playFromBeginning()

    }

    // MARK: UIGestureRecognizer

    func handleTapGestureRecognizer(gestureRecognizer: UITapGestureRecognizer) {
        switch (self.player.playbackState.rawValue) {
            case PlaybackState.Stopped.rawValue:
                self.player.playFromBeginning()
            case PlaybackState.Paused.rawValue:
                self.player.playFromCurrentTime()
            case PlaybackState.Playing.rawValue:
                self.player.pause()
            case PlaybackState.Failed.rawValue:
                self.player.pause()
            default:
                self.player.pause()
         }
    }

    // MARK: PlayerDelegate

    func playerReady(player: Player) {
    }

    func playerPlaybackStateDidChange(player: Player) {
    }

    func playerBufferingStateDidChange(player: Player) {
    }

    func playerPlaybackWillStartFromBeginning(player: Player) {
    }

    func playerPlaybackDidEnd(player: Player) {
    }


    //TELA
    override func shouldAutorotate() -> Bool {
        return false
    }

}

I saw it now, if I open it up safari or any other browser in my iphone the link of the web streaming version, gives the same error but if I open by my computer works normally.

  • 1

    Here the link didn’t work in any browser.

  • Opa, really, it does not work 24 hrs, usually works in the morning/afternoon, at 11:00, 12:00 hrs

  • 1

    Tomorrow at this time I test him on Swift and see what it is

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.