Viostream Upload Widget

Similar documents
Chapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21

Wanted! Introduction. Step 1: Styling your poster. Activity Checklist. In this project, you ll learn how to make your own poster.

Stamp Builder. Documentation. v1.0.0

CSS Selectors. element selectors. .class selectors. #id selectors

Deccansoft Software Services

Getting your work online. behance.net cargo collective krop coroflot

UNIVERSITI TEKNOLOGI MALAYSIA TEST 1 SEMESTER II 2012/2013

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

ADOBE 9A Adobe Dreamweaver CS4 ACE.

/* ========================================================================== PROJECT STYLES

Signs of Spring App. Release Notes Version 1.0

IBM Bluemix Node-RED Watson Starter

Multimedia Systems and Technologies Lab class 6 HTML 5 + CSS 3

COSC 2206 Internet Tools. CSS Cascading Style Sheets

Web Engineering CSS. By Assistant Prof Malik M Ali

CSS3 Basics. From & CSS Visual Dictionary Learning Curve Books, LLC

1 of 7 11/12/2009 9:29 AM

Certified CSS Designer VS-1028

CSS Cascading Style Sheets

CSS: The Basics CISC 282 September 20, 2014

Santa Tracker. Release Notes Version 1.0

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

HTML5. HTML5 Introduction. Form Input Types. Semantic Elements. Form Attributes. Form Elements. Month Number Range Search Tel Url Time Week

Website Design (Weekday) By Alabian Solutions Ltd , 2016

HTML5, CSS3, JQUERY SYLLABUS

Web Structure and Style. MB2030 Section 2 Class 4

Website Development with HTML5, CSS and Bootstrap

Creating HTML files using Notepad

Setting Up a Development Server What Is a WAMP, MAMP, or LAMP? Installing a WAMP on Windows Testing the InstallationAlternative WAMPs Installing a

HTML TAG SUMMARY HTML REFERENCE 18 TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES MOST TAGS

Cascading Style Sheets (CSS)

Website Design (Weekend) By Alabian Solutions Ltd , 2016

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2)

Appendix D CSS Properties and Values

Introduction to WEB PROGRAMMING

PHP,HTML5, CSS3, JQUERY SYLLABUS

CSS.

Taking Fireworks Template and Applying it to Dreamweaver

Creating a Navigation Bar with a Rollover Effect

CS197WP. Intro to Web Programming. Nicolas Scarrci - February 13, 2017

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

ACSC 231 Internet Technologies

Cascading Style Sheets Level 2

Styles, Style Sheets, the Box Model and Liquid Layout

READSPEAKER ENTERPRISE HIGHLIGHTING 2.5

Form Overview. Form Processing. The Form Element. CMPT 165: Form Basics

Configuring Hotspots

TAG STYLE SELECTORS. div Think of this as a box that contains things, such as text or images. It can also just be a

Web Development. With PHP. Web Development With PHP

HTML and CSS COURSE SYLLABUS


Adding CSS to your HTML

ENGINEERING DATA HUB VISUAL DESIGN SPECIFICATIONS VERSION 3. Created: 2/10/2017

CSS Cascading Style Sheets

HTML HTML5. DOM(Document Object Model) CSS CSS

Ministry of Higher Education and Scientific Research

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100

Cascading Style Sheet. Styles as Tag Attributes. Syntax. <h1>: what font type/size is used? STYLE = SELECTOR {RULES} Attributes such as bgcolor

MYGOV.SCOT ASSETS. Design Guide for Developers

While editing a page, a menu bar will appear at the top with the following options:

Using CSS for page layout

To illustrate how to set TAG styles the <body> and <h1> tags (for the BODY and the HEADING 1 styles) will be adjusted.

How to set up a local root folder and site structure

1/6/ :28 AM Approved New Course (First Version) CS 50A Course Outline as of Fall 2014

Web Design & Dev. Combo. By Alabian Solutions Ltd , 2016

CSS Styles Quick Reference Guide

PUBLISHER SPECIFIC CSS RULES

CS 350 Internet Applications I Name: Exam II (CSS) October 29, 2013

CSS Module in 2 Parts

Hands On: Dreamweaver CS3 NEW SPRY Widgets

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

Advanced Dreamweaver CS6

CSS مفاهیم ساختار و اصول استفاده و به کارگیری

Controlling Appearance the Old Way

Zen Garden. CSS Zen Garden

Web Site Design and Development Lecture 6

How to lay out a web page with CSS

CMPT 165: More CSS Basics

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

Session 4. Style Sheets (CSS) Reading & References. A reference containing tables of CSS properties

CSS. Shan-Hung Wu CS, NTHU

Table of Contents. MySource Matrix Content Types Manual

CSS worksheet. JMC 105 Drake University

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

Media Types & Media Features

HTML and CSS MIS Konstantin Bauman. Department of MIS Fox School of Business Temple University

Pliki.tpl. scripts/search.tpl. Pliki.css. Pliki.less. Dokumentacja zmian plików graficznych: rwd shoper Wersja zmian:

Web Designer s Reference

Introduction to CSS. Part 1: Simple Text Formatting. Source Files for this Exercise are available on the Course Website DW_CSS intro

CSS for Page Layout Robert K. Moniot 1

KillTest *KIJGT 3WCNKV[ $GVVGT 5GTXKEG Q&A NZZV ]]] QORRZKYZ IUS =K ULLKX LXKK [VJGZK YKX\OIK LUX UTK _KGX

Creating and Installing Custom Plesk for Windows Skins

Table Basics. The structure of an table

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web

IBM Forms V8.0 Custom Themes IBM Corporation

UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2016 EXAMINATIONS. CSC309H1 S Programming on the Web Instructor: Ahmed Shah Mashiyat

Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo

In the early days of the Web, designers just had the original 91 HTML tags to work with.

Transcription:

Viostream Upload Widget Version: 1.0 Date: 15 September, 2015 Viocorp 2015 Author Brendon Kellett

Viocorp International Pty Ltd ABN: 43 100 186 838 110 Jones Bay Wharf, 26-32 Pirrama Road, Pyrmont NSW 2009 Australia T: +61 2 8007 6200 F: +61 2 8569 1311 E: admin@viocorp.com Revision history Version Date Author/s Changes made 1.0 15/9/2015 Brendon Kellett Initial version. Review/approval Reviewed by Date Brendon Kellett 8/09/2015 Approved by Sarah Kirkby 15/09/2015 Commercial in Confidence Page 2 of 12 Version: 1.0

Contents Integration Guide... 4 Usage... 4 Generating an Upload Button... 4 Event Handling... 5 Including Metadata Fields... 7 Validation... 7 Limitations... 8 Implementation Examples... 8 Styling... 8 Code Samples... 11

Integration Guide The Viostream Upload Widget enables media assets to be uploaded into Viostream without the need to log into the Viostream console It can also be integrated with any third-party websites and web-applications. The Viostream Upload Widget must be embedded in a server-generated web page. Usage The Upload Widget is first instantiated through a call to the Viostream API to authorise upload to your account. In order to access the Viostream API, the following information is required for authentication: Account key (Username) Access key (Password) This information is available in the Manage This Account section of the Viostream Console, under the API tab. Note: Authentication must occur on the server-side to prevent your Viostream Account Key and API Access Key from being exposed on the client. The Viostream API uses Basic Authentication for access authorisation. For example, in order to obtain your Viostream account information, the following request is made to the API: Request Response GET https://api.app.viostream.com/v3/api/account/info HTTP/1.1 Host: api.app.viostream.com Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Accept: */* HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Content-Length: 90 Connection: keep-alive "id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","publickey":"vc-xxxxxxxx","title":"account Name" Generating an Upload Button 1. Call the following API endpoint with valid Basic Authentication credentials: https://api.app.viostream.com/v3/api/account/newupload Commercial in Confidence Page 4 of 12 Version 1.0

This will return a signed URL that will temporarily authorise the Upload Widget to upload to your Viostream account: inituploadurl: "https://api.app.viostream.com/v3/api/account/initupload?publickey=vc-xxxxxxxx&expiry=2015-07- 23T14%3a31%3a35.5949144%2b10%3a00&signature=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" Note: This signed URL has an expiry timestamp - therefore a new URL must be requested each time the Upload Widget is instantiated. 2. To generate the button, place the following JavaScript within the <head> tags of the page where the button should appear: <script src="http://publish.viostream.com/widgets/uploader/js"></script> 3. Place a div element where the button should appear, then call the Upload Widget Add method, passing the div s ID and the signed URL: <div id="uploadbutton"></div> <script> $v.uploader.add('uploadbutton', '[inituploadurl]'); </script Event Handling The Upload Widget supports the following events which can be used to indicate status and progress of the upload to the user: start progress complete failed Called when the upload starts Called when the upload progress updates Called when the upload completes Called when an error occurs Commercial in Confidence Page 5 of 12 Version 1.0

Event Handling Example: <script> var widgetprogress = $('#widget-progress'); $v.uploader.on('start', function (key, filename, filesize) widgetprogress.append('<div data-key="' + key + '"><em>' + filename + '' + '</em><span>0%</span></div>'); ); $v.uploader.on('progress', function (key, percent) var bar = widgetprogress.find('[data-key="' + key + '"]').find('span'); bar.width(400 * (percent / 100)); bar.text(percent + "%"); ); $v.uploader.on('complete', function (key) var p = widgetprogress.find('[data-key="' + key + '"]').addclass('complete'); p.find('span').width(400).text("done!"); window.settimeout(function () p.fadeout(300, function () p.remove(); ), 5000); ); $v.uploader.on('failed', function (key, message) if (!key && message) alert(message); var p = widgetprogress.find('[data-key="' + key + '"]').addclass('failed'); p.find('span').removeattr('style').text("failed!"); window.settimeout(function () p.fadeout(300, function () p.remove(); ), 10000); ); $v.uploader.add(uploadbutton, https://api.app.viostream.com/v3/api/account/initupload?publickey=vc- XXXXXXXX&expiry=2015-07- 23T14%3a31%3a35.5949144%2b10%3a00&signature=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); </script> The key parameter that is passed to these events is the referenceid for the new Media and it can be used to query the API. https://api.app.viostream.com/v3/api/media/detail?mediaid=xxxxxxxxxxxxxx Commercial in Confidence Page 6 of 12 Version 1.0

Including Metadata Fields Currently, the Upload Widget supports Title, Description and Tags. To allow the user to specify these properties: 1. Place a div in the page, and ensure the div s ID matches the upload button s div ID with -form appended. 2. Then place appropriate form elements within this div, with the appropriate name attributes as shown in the example below. <div id="uploadbutton-form"> <input id="title" name="title" placeholder="title" type="text"> <textarea id="description" name="description" placeholder="description"></textarea> <input id="tags" name="tags" placeholder="title" type="text"> </div> Multiple tags are supported; end users should separate tags with a comma. All fields are optional. The Upload Widget will serialise the fields in this div and submit them with the uploaded asset. Validation To validate the metadata fields, the Upload Widget will call an optional validation function when the user clicks the upload button. To specify a validation function: call the Validate method and pass it the upload button s div ID and the validation function: Validation Example: <script> function validate() isvalid = true; titleinput = document.getelementbyid("title"); if(titleinput.value == null titleinput.value == "") alert("please specify a title"); isvalid = false; return isvalid; $v.uploader.validate('uploadbutton', validate); </script> Commercial in Confidence Page 7 of 12 Version 1.0

Limitations The Viostream Upload Widget can only ingest video and audio. Other than Title, Description, and Tags, no metadata can be applied to the asset at upload, and will need to be added to the asset through the Viostream console. All media assets uploaded through the Upload Widget will be created by the System user rather than a specific console user account. Support for Internet Explorer 8 and 9 requires Silverlight to be installed on the end user s browser. Implementation Examples Examples of the Upload Button are available online for testing and demonstration purposes and can be found at the following URLs: PHP: http://stg.viocorp.com/uploadwidget/prod.php C#: http://publish.viostream.com/widgets/uploader/ The code used to create these examples is available in the Code Samples section of this document. Styling CSS Styles can be applied to change the look of the upload button and progress bar. Commercial in Confidence Page 8 of 12 Version 1.0

Example Upload Progress Bar Style: #widget-progress line-height: 24px; font-family: Arial; font-size: 12px; #widget-progress div.complete opacity: 0.5; #widget-progress div.failed opacity: 0.7; color: red!important; #widget-progress em display: inline-block; background: #F1EFE8; color: #AAA79E; width: 146px; padding: 0 8px; height: 24px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: normal; font-weight: bold; #widget-progress span display: inline-block; height: 24px; margin-left: 2px; background: #AAA79E; color: #FFF; text-indent: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 26px; transition: width 1s; Commercial in Confidence Page 9 of 12 Version 1.0

Example Button Style:.upload-widget-btn background: #fd8505; color: #fff; display: inline-block; font-size: 14px; font-weight: bold; padding: 8px 16px; text-decoration: none; overflow: hidden; font-family: sans-serif; position: relative;.upload-widget-btn:hover,.upload-widget-btn:active,.upload-widget-btn:focus text-decoration: none; color: #fff; background: #ee5a00;.upload-widget-btn object position: absolute; top: 0; left: 0; right: 0; bottom: 0;.upload-widget-btn input position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; Note: Appearance of the Upload Widget after the above styles are applied Commercial in Confidence Page 10 of 12 Version 1.0

Code Samples PHP: $apiurl = "https://api.app.viostream.com/v3/api/"; function CallApi($url, $user, $pass) $curl = curl_init(); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, $user.":".$pass); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($curl); curl_close($curl); $initupload; return json_decode($result); if (isset($_post["publickey"]) && isset($_post["accesskey"])) $initupload = CallAPI($apiUrl."account/newupload", $_POST["publicKey"], $_POST["accessKey"]); echo $initupload->inituploadurl; Commercial in Confidence Page 11 of 12 Version 1.0

C#.NET MVC: using System; using System.Net.Http; using System.Text; using System.Web.Mvc; public class UploaderController : Controller const string publickey = "PUBLIC_KEY"; const string accesskey = "ACCESS_KEY"; public ActionResult Index() if (!string.isnullorempty(publickey) &&!string.isnullorempty(accesskey)) UploaderViewModel model; var route = "https://api.app.viostream.com/v3/api/account/newupload"; if (TryGetModel(route, publickey, accesskey, out model)) return View(model); return View(new UploaderViewModel()); public bool TryGetModel<T>(string route, string username, string password, out T model) where T : new() model = default(t); try using (var client = new HttpClient()) var request = new HttpRequestMessage(HttpMethod.Get, route); request.headers.add("authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(username + ":" + password))); var response = client.sendasync(request).result; if (response.issuccessstatuscode) model = response.content.readasasync<t>().result; return true; return false; catch (Exception) return false; public class UploaderViewModel public string InitUploadUrl get; set; Commercial in Confidence Page 12 of 12 Version 1.0