I'm trying to play a video streaming but is giving audio issues . On the Android platform, I have been able to reproduce it without errors and the web is also in a good quality.
I have already taken several examples of projects that reproduce streaming on the internet, but all have the same error in the audio when I put the link I am using.
Because it works on other platforms, I think it should 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 in ios) - If you know any solution, it can be either in Swift or objective-C.
link streaming - link
link web - link
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
}
}
Now, if I open the safari or any other browser on my iphone the web streaming version link, it gives the same error but, my computer works normally.