Playing video back with guest account

4 views
Skip to first unread message

Jared T.

unread,
Jan 3, 2011, 3:22:11 AM1/3/11
to CallWidget-Developers
I'm able to record a video using a guest account, but am experiencing
difficulty in playing it back. I'll include a snippet of what I'm
doing (using v0 of the PHP SDK):

https://gist.github.com/763251

Any pointers on where I might be tripping up? I can do all of this
using a guess account, correct?

Melih Onvural

unread,
Jan 3, 2011, 12:24:55 PM1/3/11
to tokbox-d...@googlegroups.com
Jared,

You are getting what is known as the:

contentId

the video mail itself is identified by the:

messageId

To get the messageId you will need to use the following function which is in the TokBoxApi class:

getMessagesWithContent($contentId)


We currently don't have a wrapper for that function which parses the XML and returns the message ID cleanly, but there are good examples in the TokBoxCall.php file about how to do this. You will want to use simplexml to grab the messageId field of the response to the aforementioned function call, and then pass that into your generateRecorderEmbed(...) function.

I hope that this makes sense. Please let me know if you need some more help with the XML parsing.
--
Melih O.
me...@tokbox.com

> --
> You received this message because you are subscribed to the Google Groups "CallWidget-Developers" group.
> To post to this group, send email to tokbox-d...@googlegroups.com.
> To unsubscribe from this group, send email to tokbox-develop...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/tokbox-developers?hl=en.
>

Jared T.

unread,
Jan 4, 2011, 5:33:09 PM1/4/11
to CallWidget-Developers
Melih,

I get an error in the XML returned: https://gist.github.com/765571

Here is the code I've used: https://gist.github.com/765576

Is there something I'm doing wrong? I think I'm supposed to pass an
access key and a secret somewhere, but doesn't that require
registering the user? I'm trying to do all of this under a guest
account.

Thanks,
Jared

Jared T.

unread,
Jan 4, 2011, 5:43:47 PM1/4/11
to CallWidget-Developers
Melih,

If I do something like this:

$apiObj = new TokBoxApi(user_key, user_secret);

How/where do I obtain the user_key and user_secret? I tried this
before and it says bad credentials were used. Do I need to register
the user in order to get that information?

On Jan 3, 11:24 am, Melih Onvural <me...@tokbox.com> wrote:

Melih Onvural

unread,
Jan 4, 2011, 6:00:18 PM1/4/11
to tokbox-d...@googlegroups.com
Jared,

The API call has been changed to require_guest from require_user. This should resolve the need that was originally in place for a registered user and their credentials. I have pushed
this code to the Sandbox environment, and I'll notify the list when it goes into production.

Best.
--
Melih O.
me...@tokbox.com

Jared T.

unread,
Jan 4, 2011, 9:44:46 PM1/4/11
to CallWidget-Developers
Thanks Melih, I'd be interested in this updated version.

Cheers,
Jared

Melih Onvural

unread,
Jan 4, 2011, 10:26:59 PM1/4/11
to tokbox-d...@googlegroups.com
Jared,

Could you please test against the Sandbox environment, and then let me know that it's working as you expect?

Thanks.
--
Melih O.
me...@tokbox.com

Jared T.

unread,
Jan 5, 2011, 6:51:15 PM1/5/11
to CallWidget-Developers
Melih,

I looked at the download page and I didn't see an update (http://
code.google.com/p/tokboxapi/downloads/list) for the PHP SDK v0.

Here's my updated code: https://gist.github.com/767254
Here's the XML response: https://gist.github.com/767245

Still not working for me as you can tell from the XML response.

Thanks,
Jared

Jared T.

unread,
Jan 5, 2011, 6:56:02 PM1/5/11
to CallWidget-Developers
Melih,

Sorry for two responses, but I tried uncommenting those blocks of code
from BaseApi and TokBoxApi, and passing in the application partner key/
secret like this:

$apiObj2 = new TokBoxApi(API_Config::PARTNER_KEY,
API_Config::PARTNER_SECRET);

This correctly inserts my partner key and secret, but the XML response
returned is the same as the one pasted from my last response (API Auth
Code 401: Request signature did not match).

Thanks,
Jared

Melih Onvural

unread,
Jan 5, 2011, 7:10:35 PM1/5/11
to tokbox-d...@googlegroups.com
Jared,

You aren't creating a guest user and signing as your guest user. Try to instead do the following:

$apiObj = TokBoxUser::createGuest();
$result = $apiObj->getMessagesWithContent("3c7w6a941270");
print_r($result);

with the appropriate includes and the like. I think this will resolve the issue you're facing with the response.
--
Melih O.
me...@tokbox.com

Jared T.

unread,
Jan 8, 2011, 4:12:08 AM1/8/11
to CallWidget-Developers
Melih,

Thanks very much, got it working!

Jared

Melih Onvural

unread,
Jan 8, 2011, 5:13:50 AM1/8/11
to tokbox-d...@googlegroups.com, CallWidget-Developers
Jared,

That's really great! Any chance you could share the parsing code back into the SDK for the community at large? I'll throw in a TokBox tshirt if that sweetens the deal!

Best,
Melih O.
me...@tokbox.com

Sent from my iPhone

Jared T.

unread,
Jan 8, 2011, 5:49:14 AM1/8/11
to CallWidget-Developers
Absolutely. I'll post an example of what I have from the top. The
XML parsing is done on the last few lines below.

<?php
// dependencies (notice i've chosen to name my php sdk v0 directory
'SDK0', but you can pick anything)
require_once 'SDK0/API_Config.php';
require_once 'SDK0/TokBoxVideo.php';
require_once 'SDK0/TokBoxUser.php';
require_once 'SDK0/BaseApi.php';
require_once 'SDK0/TokBoxApi.php';

try {
$apiObj = TokBoxUser::createGuest();
echo "printing results:<br/>";
echo "Jabber ID: ".$apiObj->getJabberId()."<br/>";
} catch(Exception $e) {
echo "EXCEPTION: ".$e->getMessage();
}
?>

<script type="text/javascript">
// automatically called after the vmail is sent
function vmailSent(vmailID) {
console.log("vmailID = " + vmailID); // example: 3c7w6a941270
}
</script>

<h1>Record a video</h1>
<p><?php echo TokBoxVideo::generateRecorderEmbedCodeToMe("your
+em...@gmail.com"); ?></p>

<h1>Saved video playback</h1>
<p>
<?php
/*
Steps to playback a video in TokBox:
1) Get vmail ID after the intro is recorded (javascript callback
above)
2) Get message ID using getMessagesWithContent()
3) Playback video using generatePlayerEmbedCode()
See: http://groups.google.com/group/tokbox-developers/browse_thread/thread/8f9a1c81448617dd
*/
$result = $apiObj->getMessagesWithContent("3c7w6a941270"); // just
an example
$xml = simplexml_load_string($result); // using simplexml to parse
the xml data
$messageId = $xml->vmailSet->videoMail->content->messageId;
echo TokBoxVideo::generatePlayerEmbedCode($messageId);
?>
</p>

Melih Onvural

unread,
Jan 9, 2011, 11:37:43 PM1/9/11
to tokbox-d...@googlegroups.com
Thanks for that Jared. I'll go ahead and throw it into the SDK so others can take advantage of it as well.

Could you send me your shirt size and mailing address off-list, and we'll get you a t-shirt?

Thanks again.

Reply all
Reply to author
Forward
0 new messages