0

I am trying opentok 1-1 video in codeigniter. Uploaded my code on server but not showing only self video not other user video. My controller

class Welcome extends CI_Controller {

    public function index()
    {
        $this->load->view('welcome_message');
    }

    public function startVideo()
    {               
        $opentok = new OpenTok($this->config->item('opentok_key'), $this->config->item('opentok_secret'));

        $session = $opentok->createSession();

        $data = array(
            'apiKey' => $this->config->item('opentok_key'),
            'sessionId' => $session->getSessionId(),
            'token' => $session->generateToken()
        );
        echo "<pre />"; print_r($data);
        $this->load->view('video_11', $data);       
    }       
}

view file OpenTok Video assets/css/app.css" rel="stylesheet" type="text/css">

<div id="videos">
    <div id="subscriber"></div>
    <div id="publisher"></div>
</div>

<script>
    var apiKey = "<?php echo $apiKey;?>";          //YOUR_API_KEY;
    var sessionId = "<?php echo $sessionId;?>";
    var token = "<?php echo $token;?>";

    //alert(apiKey +' == '+ sessionId);
</script>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/app.js"></script>

After uploading on server, I am calling this URL from on 2 different systems

URL - example.com/Welcome/startVideo/
on both i can see self video not of other user. this is my issue 
Lucas Huang
  • 3,998
  • 3
  • 20
  • 29
Amresh
  • 61
  • 5
  • hi @Amresh, can you check if two users have the same session id? That's the way how OpenTok cloud connects two ends. – Lucas Huang May 26 '17 at 17:34
  • Hi @LucasHuang Thanks for your comment. I have open this startVideo function on 2 different windows . i am getting 2 different session ids and tokens on browers. If i have to use same session id for all different users can you provide me some help/example. – Amresh May 30 '17 at 05:20

1 Answers1

0

For answering the question, two connection can not locate each other because they are using two different session IDs.

For your reference @Amresh, Tokbox has a great PHP example here: https://github.com/opentok/learning-opentok-php. You can follow the instruction in the README.md to quickly launch the sample PHP backend app for testing. It is also a good example for you to follow for your backend development.

Hope it helps.

Lucas Huang
  • 3,998
  • 3
  • 20
  • 29
  • Thanks a lot @lucas Huang. I have followed links and now my 1-1 video streaming working great. Done both PHP server side and JS client. Next will try 1-many with templating part (good looking design). Please can you suggest any links or blogs for this. Thank yo again. – Amresh Jun 02 '17 at 08:59