I'm developing a iptv for ios devices. So far i can play a list of channels. Deployment target is 8.0. I have tested with iphone s5 virtual device and i can play the stream correctly. i decided to test it on a real device. The application run perfectly but the stream wont open. screen remains black. How is it possible i cant open streams in real device when virtual devices do? Here is my code.
func play(var currentChannel:TVChannel){
moviePlayer?.stop();
var URL:String = currentChannel.channelUrl;
var _URL = Encryption().Decrypt(plainText: URL);
var url:NSURL = NSURL(string: _URL)!
println(url);
moviePlayer = MPMoviePlayerController(contentURL: url)
moviePlayer?.controlStyle = MPMovieControlStyle.None;
if(db.select.getStringValue(forKey: db.STRING_VALUE_CURRENT_CHANNEL) == nil){
db.insert.CoreData_Insert(value: "-1", coreDataKey: db.STRING_VALUE_CURRENT_CHANNEL)
}
//send log
Logs().sendHit(currentChannel.channelNumber, accessway: access_way, lastchannel: db.select.getStringValue(forKey: db.STRING_VALUE_CURRENT_CHANNEL).value, username: db.select.getStringValue(forKey: db.STRING_VALUE_USERNAME).value);
db.delete.deleteEntityFromCore(entityName: "StringValue", field_Name: "key", field_Value: db.STRING_VALUE_CURRENT_CHANNEL);
//save the new channel
db.insert.CoreData_Insert(value: currentChannel.channelNumber, coreDataKey: db.STRING_VALUE_CURRENT_CHANNEL);
if let player = moviePlayer{
player.view.frame = self.view.bounds
player.prepareToPlay()
player.scalingMode = .AspectFill
self.view.addSubview(player.view)
self.view.bringSubviewToFront(two_way_channel);
player.play();
}
self.updateOSD();
}
Any help is appreciated. Thank You
This code run perfectly, my problem was that CDN (akamai) had a restriction for user agent of the client who asked for a channel stream. Somehow the virtual device user agent could pass the restriction. This happens because probably iphone s5 real device and iphone s5 virtual device have different user agent.