【问题标题】:IP Camera Streaming on iPad stuckiPad上的IP Camera Streaming卡住了
【发布时间】:2013-06-17 08:11:47
【问题描述】:

我正在 iPad 上从名为 Foscam 的 IP 摄像机获取流媒体。如果我在 iPad 浏览器中打开 IP,那么它运行良好,但是当我在我的应用程序中获取流时,它会出现第一个屏幕截图并卡在上面。应用程序没有从 cam 获得连续的流媒体。我就是这样用的

- (IBAction)powerChanged:(id)sender {
    UISwitch * s = (UISwitch *)sender;
    if( s.on == TRUE){
        [self initializeData];
        if(![deviceClient connect]){
            UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Can not connect to T-Rex device!"
                                                              message:[[NSString alloc] initWithFormat:@"Could not connec to %@ and %d port",deviceClient.host,deviceClient.port] 
                                                             delegate:nil
                                                    cancelButtonTitle:@"OK"
                                                    otherButtonTitles:nil];
                                    [message show];
                                    [s setOn:FALSE animated:TRUE];
        } else {
           [self adjustLayout:TRUE]; 
            [self startFrequencyTimer];
        }
    }else {
        [self stopFrequencyTimer];
        [self adjustLayout:FALSE];
    }
}

-(void)initializeData {
    [cameraViewFront loadRequest:[NSURLRequest requestWithURL:[frontCameraClient getVideoStreamURL]]];
}
-(BOOL)connect {
    if (udpSocket == nil){
        udpSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];
    }
    NSLog(@"host %@ and port %i", self.host, self.port);
    return [udpSocket connectToHost:self.host onPort:self.port error:nil];
}
- (NSURL *) getURL:(NSString *)forPage {
    NSLog(@"front cam IP %@" ,self.host);
    return [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"http://%@/%@user=%@&pwd=%@",self.host,forPage,self.username, self.password]];
}

-(NSURL *)getVideoStreamURL{
    return [self getURL:@"videostream.cgi?"];
}

【问题讨论】:

    标签: ios objective-c ipad streaming ip-camera


    【解决方案1】:

    我想通了。我正在使用 foscam 并且 foscam 在此 link 上提供了 URL 列表,因此我搜索了我的 cam 模型,然后尝试了所有给定的 MPEG 连接类型 URL,http://IPADDRESS/videostream.cgi?user=[USERNAME]&pwd=[PASSWORD]&resolution=32&rate=0 URL 适用于我的案例。但是仍然存在一个问题,它在 iOS5 上运行得非常好,在 iOS6 上它仍然停留在第一帧。 为了解决这个问题,link 帮了我很多忙。此方法适用于 iOS5 和 6。

    【讨论】:

      猜你喜欢
      • 2021-06-29
      • 1970-01-01
      • 1970-01-01
      • 2012-06-23
      • 2021-10-08
      • 2016-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多