Get direct URL of video after recording
In some cases you might want to get the direct URL of the video with your code. True, all you need is the video token to create the video in your Ziggeo player. What about the cases when the URL is requirement of some other system? There are services that require direct URL and you want to add it there as soon as you can.
With just a small code you can utilize Ziggeo API within your code and quickly get the URL.
Code
Lets say that you have the following header code
<link rel="stylesheet" href="https://assets.ziggeo.com/v2-stable/ziggeo.css" /> <script src="https://assets.ziggeo.com/v2-stable/ziggeo.js"></script> <script> var ziggeo_app = new ZiggeoApi.V2.Application({ token:"APPLICATION_TOKEN", webrtc_streaming_if_necessary: true, webrtc_on_mobile: true }); </script>
- Of course instead of "APPLICATION_TOKEN" you would have your actual application token. To have it you will need to create your own Ziggeo account unless you already have one. In that case sign in instead.
Now with that out of the way we need to add the code and that is super simple. Check out the following line:
<script> alert(ziggeo_app.videos.videoUrl('VIDEO_TOKEN')); </script>
Is there other way of doing it?
Yes of course, using our API you can get the same using another short and simple code like this one:
<script> alert(ZiggeoApi.Videos.source('VIDEO_TOKEN')); </script>
So which one should you use?
We recommend using API calls depending on your use case. In most cases you will be fine with either of the two options above. If you however have multiple applications within your page, you would be better off using the application call. That way your calls are directly connected to the application under which you are making the request.
For more API calls you could utilize, check out our JS SDK API page here.