Example of iOS application with two players
This example demonstrates how two or more players can be displayed in one application. Each of the players can be used to play a different stream.
Work with code of the example
To analyze the code, let's take TwoPlayers example version with hash 088a74d, which can be downloaded with build 2.2.4.
View class for the main view of the application: ViewController (header file ViewController.h; implementation file ViewController.m).
Functions of establishing connection, creating stream and starting playback work the same as described in the example Player.
Unlike the example Player, method for establishing connection is called when Connect button is tapped.
[self connect];
This example has two views for displaying video and two corresponding Play buttons; corresponding method is called to start playing when one of the buttons is tapped.
[self play1Stream];
[self play2Stream];
Playback is stopped when corresponding Stop button is tapped: FPWCSApi2Stream method stop is called for corresponding stream
[player1Stream stop:&error];
[player2Stream stop:&error];