Some examples below demonstrate how web developers can use our solution. Actually you can create your site using any language you want. Examples are just samples from production use cases of the plugin. We can assist you making necessary changes for any language you need. We like to add new samples for different languages so if you cannot find sample for language you need - just let us know. Server side script development is free if you cannot use existing examples. Just let us know.

PHP

  1. <?php
  2. $today = gmdate("n/j/Y g:i:s A");
  3.  
  4. $initial_url = "mms://115.125.166.250/test";
  5.  
  6. $url_with_servertime = $initial_url ."?server_time=" . $today;
  7.  
  8. $ip = "212.16.193.118";
  9. $key = "defaultpassword";
  10.  
  11. $validminutes = 5;
  12.  
  13. $str2hash = $ip . $key . $today . $validminutes;
  14.  
  15. $md5raw = md5($str2hash, true);
  16.  
  17. $base64hash = base64_encode($md5raw);
  18.  
  19. $signedurl = $url_with_servertime ."&hash_value=" . $base64hash;
  20.  
  21. $signedurlwithvalidinterval = $signedurl . "&validminutes=$validminutes";
  22.  
  23. echo $signedurlwithvalidinterval . "\n";
  24. ?>

Ruby On Rails controller side

  1. class MyController < ApplicationController
  2.   def get_link
  3.     remote_ip = request.remote_ip
  4.     today = Time.now.utc.strftime "%m/%d/%Y %I:%M:%S %p"
  5.     key = "defaultpassword"
  6.     val_min = "5"
  7.     md5 = Digest::MD5.hexdigest remote_ip + key + today + val_min
  8.     md5str = ""
  9.     md5.scan(/../).each { | tuple | md5str << tuple.hex.chr }
  10.     @signature = "?server_time=#{today}&hash_value=#{Base64.encode64(md5str)[0...-1]}&validminutes=#{val_min}"
  11.   end
  12. end

Ruby On rails view side

  1. <h3>Movie List</h3>
  2. <ul>
  3.   <li>
  4.     <%= link_to "Same movie", "http://127.0.0.1/same_publish_point#{@signature}" -%>
  5.   </li>
  6.   <li>
  7.     <%= link_to "Another movie", "http://127.0.0.1/another_publish_point#{@signature}" -%>
  8.   </li>
  9.   <li>
  10.     <%= link_to "Third movie", "http://127.0.0.1/third_publish_point#{@signature}" -%>
  11.   </li>
  12. </ul>

C#

  1. using System;
  2. using System.Security.Cryptography;
  3. using System.Globalization;
  4.  
  5. namespace AuthorizedURLProcessor
  6. {
  7.  
  8.  public class URLProcessor
  9.  {
  10.  
  11.           public static string BuildProtectedURLWithValidity(string password, string media_url, string ip, int valid)
  12.           {
  13.               string result = null;
  14.               DateTime cur_date = DateTime.Now;
  15.               TimeZone localzone = TimeZone.CurrentTimeZone;
  16.  
  17.               DateTime localTime = localzone.ToUniversalTime(cur_date);
  18.  
  19.               string date_time = localTime.ToString(new CultureInfo("en-us"));
  20.  
  21.               Int32 Valid = valid;
  22.               string to_be_hashed = ip + password + date_time + Valid.ToString();
  23.  
  24.               byte[] to_be_hashed_byte_array = new byte[to_be_hashed.Length];
  25.  
  26.               int i = 0;
  27.               foreach (char cur_char in to_be_hashed)
  28.               {  
  29.                   to_be_hashed_byte_array[i++] = (byte)cur_char;
  30.               }
  31.  
  32.               byte[] hash = (new MD5CryptoServiceProvider()).ComputeHash(to_be_hashed_byte_array);
  33.  
  34.               string md5_signature = Convert.ToBase64String(hash);
  35.  
  36.               result = media_url + "?server_time=" + date_time + "&hash_value=" + md5_signature + "&validminutes=" + Valid.ToString();
  37.               return (result);
  38.           }
  39.        }
  40. }


Take a look at WMSPanel github page to see examples for Wowza Media Server.