Media Object

Methods: info create upload update delete

info

Get information about media by it's code.

Input parameters

Required parameters:

  • String apikey (Project API-key)
  • String code (Media code)

Output parameters

  • String Title (Title of media file)
  • Integer Width (Video width)
  • Integer Height (Video height)
  • Integer Duration (Video duration in sec)
  • String PlayerCode (Player code)
  • String Poster - Code (Poster code)
  • Integer Poster - Width (Poster width)
  • Integer Poster - Height (Poster height)
  • String Poster - Url (Link to Poster)
  • String Transcodes - Item - Code (Transcode code)
  • String Transcodes - Item - Title (Transcode quality)
  • Integer Transcodes - Item - Width (Video width)
  • Integer Transcodes - Item - Height (Video height)
  • String Transcodes - Item - PseudoFLV (Link to PseudoFLV)
  • String Transcodes - Item - PseudoMP4 (Link to PseudoMP4)
  • String Transcodes - Item - AdobeHDS (Link to AdobeHDS)
  • String Transcodes - Item - AppleHLS (Link to AppleHLS)
  • String Transcodes - Item - MicrosoftSmooth (Link to MicrosoftSmooth)
  • String Screenshots - Item - Code (Screenshot code)
  • Integer Screenshots - Item - Width (Screenshot width)
  • Integer Screenshots - Item - Height (Screenshot height)
  • String Screenshots - Item - Url (Link to Screenshot)

Sample query:

http://boomstream.com/api/media/info?apikey=[API_KEY]&code=xxxxxxxx

Sample response:

<Response>
    <Title>Promo</Title>
    <Width>1600</Width>
    <Height>900</Height>
    <Duration>61</Duration>
    <PlayerCode>&lt;iframe width=&quot;{{width}}&quot; height=&quot;{{height}}&quot;
src=&quot;http://boomstream.com/player.html?code=xxxxxxxx&quot; frameborder=&quot;0&quot;
scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;</PlayerCode>
    <Poster>
        <Code>xxxxxxxx-m3</Code>
        <Width>1920</Width>
        <Height>1080</Height>
        <Url>http://bs.boomstream.com/balancer/xxxxxxxx-m3.jpg</Url>
    </Poster>
    <Transcodes>
        <Item>
            <Code>xxxxxxxx-u0cu3fcd</Code>
            <Title>360p</Title>
            <Width>640</Width>
            <Height>360</Height>
            <PseudoFLV>http://bs.boomstream.com/balancer/xxxxxxxx-u0cu3fcd.flv</PseudoFLV>
            <PseudoMP4>http://bs.boomstream.com/balancer/xxxxxxxx-u0cu3fcd.mp4</PseudoMP4>
            <AdobeHDS>http://bs.boomstream.com/balancer/xxxxxxxx-u0cu3fcd/manifest.f4m</AdobeHDS>
            <AppleHLS>http://bs.boomstream.com/balancer/xxxxxxxx-u0cu3fcd/playlist.m3u8</AppleHLS>
            <MicrosoftSmooth>http://bs.boomstream.com/balancer/xxxxxxxx-u0cu3fcd/Manifest</MicrosoftSmooth>
        </Item>
    </Transcodes>
    <Adaptive>
        <AppleHLS>http://bs.boomstream.com/adaptive/xxxxxxxx/playlist.m3u8</AppleHLS>
    </Adaptive>
    <Screenshots>
        <Item>
            <Code>xxxxxxxx-m3</Code>
            <Width>1920</Width>
            <Height>1080</Height>
            <Url>http://bs.boomstream.com/balancer/xxxxxxxx-m3.jpg</Url>
        </Item>
    </Screenshots>
        <Item>
            <Code>xxxxxxxx-a1</Code>
            <Width>1600</Width>
            <Height>900</Height>
            <Url>http://bs.boomstream.com/balancer/xxxxxxxx-a1.jpg</Url>
        </Item>
    <Status>Success</Status>
</Response>

create

Create new media file

Input parameters

Required parameters:

  • String apikey (Project API-key)
  • String title (Media title)
  • String link (Reference to the source)

Sample query:

http://boomstream.com/api/media/create?apikey=[API_KEY]&link=http://example.com/video.mp4&title=temp

Sample response:

<Response>
    <Code>dNO6bnZE</Code>
    <Status>Success</Status>
</Response>

upload

Upload new media file through an HTML form

1. Need to get data for upload form. To do this, run the following query:

Input parameters

Required parameters:

  • String apikey (Project API-key)
  • String title (Media title)

Sample query:

http://boomstream.com/api/media/upload?apikey=[API_KEY]&title=temp

Sample response:

<Response>
  <UploadUrl>
    http://node.org/upload/hash:8d7cd/f1a05782f77aca5cc78647178110ac8a
  </UploadUrl>
  <ProgressBarUrl>
    http://boomstream.com/api/media/progressbar
  </ProgressBarUrl>
  <Status>
    Success
  </Status>
</Response>

2. Create a page of upload, for example "upload.php". Add tag “iframe” to the body and insert parameter “UploadUrl”.

Sample code:

  <body>
    <iframe src="http://localhost/iframe.php?link=<UploadUrl>">
  </body>

3. Create a page for the “Browse” button, which will be displayed in the frame - iframe.php.

Sample page code:

  <script type="text/javascript">
    function submitForm() {
        parent.runUpload();
        $('#form1').submit();
    }
  </script>

  <form action="<UploadUrl>" method="POST" enctype="multipart/form-data" id="form1">
    <input type="file" name="file" onchange="submitForm()">
  </form>

4. You must create the proxy script to get upload status - progressbar.php.

Sample page code:

  <?php
    $progressBarUrl = (isset($_GET['progressBarUrl'])) ? $_GET['progressBarUrl'] : '';
    echo @file_get_contents($progressBarUrl . '&format=json');
  ?>

5. Add code javascript on the page "upload.php". It will send every second requests to progressbar.php.

Sample page code:

  <script type="text/javascript">
    var refreshIntervalId;
    var refresh = 1000;
    function runUpload() {
      $('#form1').submit();
        refreshIntervalId = setTimeout('getPercent()', refresh);
      }
            
      function getPercent(){
        $.get('http://localhost/progressbar.php', {progressBarUrl:"<progressBarUrl>"}, function(data){
          if(data.Action=='done') {
            console.log("DONE");
          } else {
             refreshIntervalId = setTimeout('getPercent()', refresh);
          }
        },'json');
      }
   </script>

Required parameters:

  • String progressBarUrl (from first request)

Sample response:

<Response>
  <Percent>10</Percent>
  <Action>work</Action>
  ...
</Response>

When the percent reaches 100%, you will get the following response: Sample response:

<Response>
  <Action>done</Action>
  <Code>dsadas13</Code>
  ...
</Response>

This response suggests, that media file was successfully uploaded.

update

Update parameters of media or reupload the original

Input parameters

Required parameters:

  • String apikey (Project API-key)
  • String code (Media code)

Optional parameters:

  • String title (Media title)
  • String link (Reference to the source)

Sample query:

http://boomstream.com/api/media/update?apikey=[API_KEY]&code=123&link=http://example.com/video.mp4&title=test2

Sample response:

<Response>
    <Status>Success</Status>
</Response>

delete

Delete media file

Input parameters

Required parameters:

  • String apikey (Project API-key)
  • String code (Media code)

Sample query:

http://boomstream.com/api/media/delete?apikey=[API_KEY]&code=123

Sample response:

<Response>
    <Status>Success</Status>
</Response>