developing mobile applications mark green school of creative media

131
Developing Mobile Developing Mobile Applications Applications Mark Green Mark Green School of Creative Media School of Creative Media

Upload: ralph-hart

Post on 21-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Developing Mobile Applications Mark Green School of Creative Media

Developing Mobile Developing Mobile ApplicationsApplications

Mark GreenMark Green

School of Creative MediaSchool of Creative Media

Page 2: Developing Mobile Applications Mark Green School of Creative Media

IntroductionIntroduction

Have looked at some of the tools and Have looked at some of the tools and techniques used to develop mobile techniques used to develop mobile applicationsapplications

Will now look at more of the detailsWill now look at more of the details Fill in some of the details that we didn’t Fill in some of the details that we didn’t

cover earliercover earlier Provide a complete picture of application Provide a complete picture of application

developmentdevelopment

Page 3: Developing Mobile Applications Mark Green School of Creative Media

WARNINGWARNING

Some parts of this presentation have a lot Some parts of this presentation have a lot of technical informationof technical information

Will go into some of the technical detailsWill go into some of the technical details Don’t worry about following everythingDon’t worry about following everything Get the general idea of how things are Get the general idea of how things are

done, what the basic process isdone, what the basic process is Know enough to talk about it intelligentlyKnow enough to talk about it intelligently

Page 4: Developing Mobile Applications Mark Green School of Creative Media

Active ContentActive Content

Earlier we talked about forms, could Earlier we talked about forms, could collect information from usercollect information from user

Browser sent information to web serverBrowser sent information to web server Web server then generated a response Web server then generated a response

based on the user’s inputbased on the user’s input Talked briefly about CGI, the server needs Talked briefly about CGI, the server needs

to run a program to produce a new web to run a program to produce a new web pagepage

Page 5: Developing Mobile Applications Mark Green School of Creative Media

Active ContentActive Content

Look at the details of how this is doneLook at the details of how this is done Want to create web pages that have Want to create web pages that have

dynamic content:dynamic content: Respond to user inputRespond to user input Generate content based on database (search Generate content based on database (search

engines, eCommerce sites, etc)engines, eCommerce sites, etc) Generate content based on browser (WAP 1, Generate content based on browser (WAP 1,

WAP 2, standard PC, etc)WAP 2, standard PC, etc)

Page 6: Developing Mobile Applications Mark Green School of Creative Media

Active ContentActive Content

The old way of doing this was based on The old way of doing this was based on writing programswriting programs

A C++ or Java program would retrieve A C++ or Java program would retrieve information sent by browserinformation sent by browser

It would then generate the new page by It would then generate the new page by writing all of the html from within the writing all of the html from within the programprogram

Not easy to do, and hard to change page Not easy to do, and hard to change page layoutlayout

Page 7: Developing Mobile Applications Mark Green School of Creative Media

Active ContentActive Content

Active content is a way of avoiding most of Active content is a way of avoiding most of the programmingthe programming

A collection of similar techniques, such as A collection of similar techniques, such as ASP and JSPASP and JSP

All based on the same basic idea, just All based on the same basic idea, just some of the details are differentsome of the details are different

Allow content designers to design most of Allow content designers to design most of the page without needing to programthe page without needing to program

Page 8: Developing Mobile Applications Mark Green School of Creative Media

Active ContentActive Content

Takes the opposite approach to CGITakes the opposite approach to CGI Instead of writing a program to generate Instead of writing a program to generate

html, put parts of the program into the web html, put parts of the program into the web pagepage

Browser doesn’t know the difference, it Browser doesn’t know the difference, it uses the same techniques for CGI and uses the same techniques for CGI and active contentactive content

No need to change the browser, all No need to change the browser, all changes are in the serverchanges are in the server

Page 9: Developing Mobile Applications Mark Green School of Creative Media

Active ContentActive Content

The basic idea is very simpleThe basic idea is very simple Most of the web page is done in standard Most of the web page is done in standard

html or xhtmlhtml or xhtml This is the same as developing a standard This is the same as developing a standard

web pageweb page The parts of the page that need to be The parts of the page that need to be

changed are handled by a small script that changed are handled by a small script that generates the htmlgenerates the html

Page 10: Developing Mobile Applications Mark Green School of Creative Media

Active ContentActive Content

When a browser asks for an active page When a browser asks for an active page the following things happen:the following things happen: The server finds the pageThe server finds the page It copies the standard html directly to the It copies the standard html directly to the

browserbrowser To generate the dynamic parts of the page it To generate the dynamic parts of the page it

runs the scripts, sends the output from the runs the scripts, sends the output from the scripts to the browserscripts to the browser

The server needs to do more work, but the The server needs to do more work, but the browser just sees standard htmlbrowser just sees standard html

Page 11: Developing Mobile Applications Mark Green School of Creative Media

Active ContentActive Content

Basically the same as handling a standard Basically the same as handling a standard web pageweb page

The only difference is the web server runs The only difference is the web server runs the scripts to generate the dynamic parts the scripts to generate the dynamic parts of the web pageof the web page

Active content doesn’t use .html or .htm, Active content doesn’t use .html or .htm, instead is uses .asp or .jsp, so the server instead is uses .asp or .jsp, so the server knows its an active pageknows its an active page

Page 12: Developing Mobile Applications Mark Green School of Creative Media

Active ContentActive Content

Most active content systems allow you to Most active content systems allow you to select the scripting language you want to select the scripting language you want to useuse

The most common scripting languages are The most common scripting languages are JavaScript and Visual Basic scriptJavaScript and Visual Basic script

Perl and Python are also quite common, Perl and Python are also quite common, mainly used with Apache (the most mainly used with Apache (the most common web server)common web server)

Page 13: Developing Mobile Applications Mark Green School of Creative Media

Active ContentActive Content

Active content is a reasonably good Active content is a reasonably good approach to developing dynamic web approach to developing dynamic web pagespages

Web designers can do most of the page Web designers can do most of the page design using tools the are familiar withdesign using tools the are familiar with

May need a programmers help to do some May need a programmers help to do some of the scripting, but once this is done they of the scripting, but once this is done they can keep working on the pagecan keep working on the page

Page 14: Developing Mobile Applications Mark Green School of Creative Media

Active ContentActive Content

There are some problems with this There are some problems with this approachapproach

The source for the web pages can be quite The source for the web pages can be quite long and hard to follow, changes may not long and hard to follow, changes may not be that easybe that easy

Scripting language may not be able to do Scripting language may not be able to do everythingeverything

May not be the most efficient approachMay not be the most efficient approach

Page 15: Developing Mobile Applications Mark Green School of Creative Media

SummarySummary

Active content allows us to produce Active content allows us to produce dynamic web pagesdynamic web pages

Handled completely on the server side, no Handled completely on the server side, no changes to the browserchanges to the browser

Embed scripts in the html for the web Embed scripts in the html for the web page, execute by server before sending to page, execute by server before sending to browserbrowser

General approach, can be used in General approach, can be used in standard applications as wellstandard applications as well

Page 16: Developing Mobile Applications Mark Green School of Creative Media

SummarySummary

Browser Web Server HTMLPage

Page Request Find Page

HTML PageHTML Page

Standard Web Page

Browser Web Server ActivePage

Active Content

Page RequestFind Page

HTML Page HTML + Script

Run Script

Page 17: Developing Mobile Applications Mark Green School of Creative Media

DetailsDetails

There are many versions of active contentThere are many versions of active content They all work in basically the same way, They all work in basically the same way,

only differ in some of the detailsonly differ in some of the details Version depends upon the web server that Version depends upon the web server that

you are usingyou are using Most servers only support one type of Most servers only support one type of

active content, so determine the web active content, so determine the web server you will be using before you start server you will be using before you start developing active contentdeveloping active content

Page 18: Developing Mobile Applications Mark Green School of Creative Media

ASPASP

The particular version of active content we The particular version of active content we will look at is ASP (Active Server Pages)will look at is ASP (Active Server Pages)

This is a Microsoft product and is part of This is a Microsoft product and is part of their IIS web servertheir IIS web server

Since we run IIS as our web server, this is Since we run IIS as our web server, this is the natural choice for our examplesthe natural choice for our examples

The example discussed here will run on The example discussed here will run on web sites hosted at SCM, so you can try it web sites hosted at SCM, so you can try it outout

Page 19: Developing Mobile Applications Mark Green School of Creative Media

ASPASP

ASP supports a wide range of scripting ASP supports a wide range of scripting languages, the documentation says over languages, the documentation says over 2020

The main ones are Visual Basic script and The main ones are Visual Basic script and JavaScriptJavaScript

We will use Visual Basic script in our We will use Visual Basic script in our examples, since it’s the standard language examples, since it’s the standard language used with ASPused with ASP

Page 20: Developing Mobile Applications Mark Green School of Creative Media

ASPASP

The script and the html content are mixed The script and the html content are mixed in the same file, so how do we separate in the same file, so how do we separate them?them?

Script commands are enclosed in the Script commands are enclosed in the special tags <% and %>special tags <% and %>

Anything between these two tags is Anything between these two tags is assumed to be script commands by the assumed to be script commands by the web server, and it will try to run themweb server, and it will try to run them

Page 21: Developing Mobile Applications Mark Green School of Creative Media

ASPASP

How does the web server know which How does the web server know which scripting language to use?scripting language to use?

We tell it by including a line like this at the We tell it by including a line like this at the beginning of the file:beginning of the file:

<%@ Language=VBScript %><%@ Language=VBScript %> This line tells the web server that we are This line tells the web server that we are

using Visual Basic script as the scripting using Visual Basic script as the scripting languagelanguage

Page 22: Developing Mobile Applications Mark Green School of Creative Media

Example OneExample One

To see how this works we will start with a To see how this works we will start with a very simple examplevery simple example

We will produce an ASP page that stores We will produce an ASP page that stores a greeting in a variable, and then includes a greeting in a variable, and then includes this greeting in the resulting web pagethis greeting in the resulting web page

We use two lines of script, one to set the We use two lines of script, one to set the variable and the other to display the variable and the other to display the variablevariable

Page 23: Developing Mobile Applications Mark Green School of Creative Media

Example OneExample One

<%@ Language=VBScript %><html><head><title>Example 1</title></head><body><%Greeting = "Hello world!"%><%= Greeting%></body></html>

Page 24: Developing Mobile Applications Mark Green School of Creative Media

Example OneExample One

There are three lines of interest in this There are three lines of interest in this exampleexample

The first line informs the web server of the The first line informs the web server of the scripting language that we are usingscripting language that we are using

Later we set the variable Later we set the variable Greeting Greeting to the to the string we are going to displaystring we are going to display

Finally we print the value of Finally we print the value of GreetingGreeting in in the web pagethe web page

Page 25: Developing Mobile Applications Mark Green School of Creative Media

Example OneExample One

To print the value of To print the value of GreetingGreeting we use the we use the following:following:

<%= Greeting%><%= Greeting%> a scripting tag that starts with = takes the a scripting tag that starts with = takes the

value after it and adds it to the web page value after it and adds it to the web page being constructedbeing constructed

One of the main things we will do is add One of the main things we will do is add things to web pages, so this short cut is things to web pages, so this short cut is handyhandy

Page 26: Developing Mobile Applications Mark Green School of Creative Media

Example TwoExample Two

Our next example is a bit more Our next example is a bit more sophisticated, we will print the greeting 10 sophisticated, we will print the greeting 10 timestimes

We do this with a FOR statement that We do this with a FOR statement that surrounds the line the adds the greeting to surrounds the line the adds the greeting to the pagethe page

Note in this case we don’t have an = at the Note in this case we don’t have an = at the beginning, since we don’t want the FOR beginning, since we don’t want the FOR added to the web pageadded to the web page

Page 27: Developing Mobile Applications Mark Green School of Creative Media

Example TwoExample Two<%@ Language=VBScript %><html><head><title>Example 2</title></head><body><%Greeting = "Hello world!"%><%FOR i = 1 TO 10 %><%= Greeting%><%NEXT%></body></html>

Page 28: Developing Mobile Applications Mark Green School of Creative Media

Example TwoExample Two

Page 29: Developing Mobile Applications Mark Green School of Creative Media

ASPASP

This example illustrates the two things This example illustrates the two things that we want to do with scripting:that we want to do with scripting:

1.1. Add something to the web page that is being Add something to the web page that is being constructedconstructed

2.2. Perform some computation that is part of the Perform some computation that is part of the application, or assists with constructing the application, or assists with constructing the web pageweb page

Not all script commands add to the web Not all script commands add to the web page, but they can be important parts of page, but they can be important parts of the applicationthe application

Page 30: Developing Mobile Applications Mark Green School of Creative Media

More DetailsMore Details

How do we make all of this work with the How do we make all of this work with the mobile phone simulator?mobile phone simulator?

In order to retrieve web pages from real In order to retrieve web pages from real web sites you need to have the WAP web sites you need to have the WAP Gateway Simulator runningGateway Simulator running

The simulator redirects your http requests The simulator redirects your http requests to a real web serverto a real web server

This is similar to what happens with real This is similar to what happens with real mobile phonesmobile phones

Page 31: Developing Mobile Applications Mark Green School of Creative Media

ObjectsObjects

The web server provides a number of The web server provides a number of objects that we can use in our scriptsobjects that we can use in our scripts

Two of the most important ones are:Two of the most important ones are:1.1. Request – this object has the information Request – this object has the information

sent from the browser when requesting the sent from the browser when requesting the page, this includes the form inputpage, this includes the form input

2.2. Response – this object contains the Response – this object contains the information that we are sending to the information that we are sending to the browserbrowser

Page 32: Developing Mobile Applications Mark Green School of Creative Media

ObjectsObjects

One of the most important response One of the most important response functions is writefunctions is write

This function adds its parameter to the This function adds its parameter to the web page that we are buildingweb page that we are building

It does basically the same thing as <%= , It does basically the same thing as <%= , but it is easier to put in a longer scriptbut it is easier to put in a longer script

To see how this works we will rewrite the To see how this works we will rewrite the second example to use this functionsecond example to use this function

Page 33: Developing Mobile Applications Mark Green School of Creative Media

Example ThreeExample Three<%@ Language=VBScript %><html><head><title>Example 3</title></head><body><%Greeting = "Hello world!"%><%FOR i = 1 TO 10 response.write GreetingNEXT%></body></html>

Page 34: Developing Mobile Applications Mark Green School of Creative Media

Form InputForm Input

One of the most important applications of One of the most important applications of ASP is processing form inputASP is processing form input

In our previous web examples we In our previous web examples we produced a number of forms, but had no produced a number of forms, but had no way of processing the information way of processing the information collectedcollected

With ASP we can collect that information With ASP we can collect that information and use it later in our applicationand use it later in our application

Page 35: Developing Mobile Applications Mark Green School of Creative Media

Example FourExample Four

Page 36: Developing Mobile Applications Mark Green School of Creative Media

Example FourExample Four

This web page allows us to enter a name This web page allows us to enter a name and several other pieces of informationand several other pieces of information

The name is sent to the browser when we The name is sent to the browser when we press the submit buttonpress the submit button

We would like to use this name in We would like to use this name in subsequent web pages, like the following subsequent web pages, like the following exampleexample

Page 37: Developing Mobile Applications Mark Green School of Creative Media

Example FourExample Four

Page 38: Developing Mobile Applications Mark Green School of Creative Media

Form InputForm Input

The form function in the request object can The form function in the request object can be used to retrieve form inputbe used to retrieve form input

The parameter to this function is the name The parameter to this function is the name of the form itemof the form item

Remember each item on a form has a Remember each item on a form has a unique name, this name is used to retrieve unique name, this name is used to retrieve the value of the itemthe value of the item

Lets look at the form firstLets look at the form first

Page 39: Developing Mobile Applications Mark Green School of Creative Media

Example Four - FormExample Four - Form<form action="example4.asp" method="post">

Name:<input type="text" name="name" title="Name" size="10"

value="Mark"/> <br/><input type="radio" name="status" value="single" title="single"

checked="checked"/>Single <br/><input type="radio" name="status" value="married" title="married" />Married <br/><input type="checkbox" name="now" title="now" checked="checked"/>Now <br/><input type="checkbox" name="today" title="today"/>Today <br/><input type="checkbox" name="tomorrow" title="tomorrow"/>Tomorrow <br/><input type="submit"/></form>

</body>

Page 40: Developing Mobile Applications Mark Green School of Creative Media

Example FourExample Four

This form starts with a text entry boxThis form starts with a text entry box The name of this box is The name of this box is namename When the form is submitted, this property When the form is submitted, this property

will have the name that the user enteredwill have the name that the user entered To retrieve this name from the form we To retrieve this name from the form we

can use:can use:request.form(“name”)request.form(“name”)

Page 41: Developing Mobile Applications Mark Green School of Creative Media

Example Four - ASPExample Four - ASP

<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd" >

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Form Example</title> </head> <body> <h1> Response </h1> <p>

Thank you for your input <%= request.form("name") %><% Session("userName") = request.form("name") %>

</p> </body></html>

Page 42: Developing Mobile Applications Mark Green School of Creative Media

Example FourExample Four

In the ASP page we retrieve the name and In the ASP page we retrieve the name and add it to the web page, this just gives add it to the web page, this just gives some feedback to the usersome feedback to the user

But what if we want to use this name on But what if we want to use this name on other web pages, say later in the session?other web pages, say later in the session?

The session object helps us with thisThe session object helps us with this Each session (a visit to the web site by a Each session (a visit to the web site by a

single user) has its own session objectsingle user) has its own session object

Page 43: Developing Mobile Applications Mark Green School of Creative Media

SessionsSessions

On the first page request a session id and On the first page request a session id and a session object are createda session object are created

The session id is part of a cookie that is The session id is part of a cookie that is sent to the browsersent to the browser

All the following requests will have this All the following requests will have this cookie, so we know the session the cookie, so we know the session the request belongs torequest belongs to

The session object lasts until the end of The session object lasts until the end of the sessionthe session

Page 44: Developing Mobile Applications Mark Green School of Creative Media

SessionsSessions

Each session can have its own set of Each session can have its own set of variablesvariables

In this example we are using the variable In this example we are using the variable userNameuserName to contain the name of the user to contain the name of the user

We set the value of this variable in the We set the value of this variable in the following way:following way:Session(“userName”) = request.form(“name”)Session(“userName”) = request.form(“name”)

Page 45: Developing Mobile Applications Mark Green School of Creative Media

SessionsSessions

In any of the subsequent web pages we In any of the subsequent web pages we can add the user’s name to the page in the can add the user’s name to the page in the following way:following way:<%= Session(“userName”) %><%= Session(“userName”) %>

A session can have any number of A session can have any number of variables and we are free to give the variables and we are free to give the variables any name we likevariables any name we like

If we have lots of visitors sessions can If we have lots of visitors sessions can take up a lot of memory in the servertake up a lot of memory in the server

Page 46: Developing Mobile Applications Mark Green School of Creative Media

SessionsSessions

How do we know when a session is over?How do we know when a session is over? This is hard, browsers don’t tell us when This is hard, browsers don’t tell us when

they are leaving our web site, so we have they are leaving our web site, so we have no way of knowing when the user leavesno way of knowing when the user leaves

ASP handles this by assuming a session ASP handles this by assuming a session has ended if there have been no page has ended if there have been no page requests for 20 minutesrequests for 20 minutes

When the session ends the session object When the session ends the session object is destroyedis destroyed

Page 47: Developing Mobile Applications Mark Green School of Creative Media

Saving DataSaving Data

Sessions allow us to save data during a Sessions allow us to save data during a session, but what about for longer periods session, but what about for longer periods of time?of time?

The application object allows all the users The application object allows all the users running the same application to share datarunning the same application to share data

This object works the same way as the This object works the same way as the session object, we can create our own session object, we can create our own variables and assign names to themvariables and assign names to them

Page 48: Developing Mobile Applications Mark Green School of Creative Media

Saving DataSaving Data

The application object is destroyed when The application object is destroyed when the web server stops running, data stored the web server stops running, data stored in it isn’t permanentin it isn’t permanent

Also the web administrator must set up the Also the web administrator must set up the application for you, the web server doesn’t application for you, the web server doesn’t do it automaticallydo it automatically

This might be useful for simple online This might be useful for simple online games or chat roomsgames or chat rooms

Page 49: Developing Mobile Applications Mark Green School of Creative Media

Saving DataSaving Data

Can also use a database to store dataCan also use a database to store data Can connect to a database from an ASP Can connect to a database from an ASP

page, do all of the standard database page, do all of the standard database operationsoperations

Retrieve and add data to the database, etcRetrieve and add data to the database, etc This is the best solution if there is a lot of This is the best solution if there is a lot of

data, or a lot of usersdata, or a lot of users Needs some knowledge of database Needs some knowledge of database

systemssystems

Page 50: Developing Mobile Applications Mark Green School of Creative Media

Saving DataSaving Data

If the data is relatively simple it can be If the data is relatively simple it can be saved in a text filesaved in a text file

Not good for a large amount of data or if Not good for a large amount of data or if accessed frequentlyaccessed frequently

To see how this works we will build a To see how this works we will build a simple guest book for our mobile servicesimple guest book for our mobile service

This will use a file to store the names of This will use a file to store the names of the people who have visited our sitethe people who have visited our site

Page 51: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

Our guest book is relatively simple, we just Our guest book is relatively simple, we just store namesstore names

Normally some comments on the web site Normally some comments on the web site would also be saved, but text is hard to would also be saved, but text is hard to enter on mobile devices, so we keep it enter on mobile devices, so we keep it simplesimple

Would also be hard to display long Would also be hard to display long comments on a mobile phonecomments on a mobile phone

Page 52: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

There are two things that we needThere are two things that we need The first is the form used to collect the The first is the form used to collect the

namesnames And the second is storing the names in the And the second is storing the names in the

guest book fileguest book file This will involve what looks like two pages This will involve what looks like two pages

to the user, but will really just be one page to the user, but will really just be one page on the web serveron the web server

Page 53: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

Page 54: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

Page 55: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

The guestbook.asp file is divided into two The guestbook.asp file is divided into two partsparts

The first part displays the form and the list The first part displays the form and the list of names in the guest bookof names in the guest book

The second part stores the name from the The second part stores the name from the form into the guest book fileform into the guest book file

There is a header at the start of the page There is a header at the start of the page that declares some variablesthat declares some variables

Page 56: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

Dim objFSO ' FileSystemObject VariableDim objFile ' File Object VariableDim strFile ' String variable to store the path / file we write to

strFile = Server.MapPath("guestbook.txt")Response.expires = -1

Page 57: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

The first three lines declare the variables The first three lines declare the variables used in the scriptused in the script

The next line gets the complete path to the The next line gets the complete path to the guestbook.txt fileguestbook.txt file

Server.MapPath adds the directory for the Server.MapPath adds the directory for the web page to the name of the fileweb page to the name of the file

The last line ensures that the page isn’t The last line ensures that the page isn’t cached in the phone, otherwise we can’t cached in the phone, otherwise we can’t get back to the first part of the pageget back to the first part of the page

Page 58: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

Next we need to determine if we need to Next we need to determine if we need to post the formpost the form

How can we tell?How can we tell? If the request as a non-empty value for the If the request as a non-empty value for the

name the user must have already entered name the user must have already entered a name, so we don’t need to post the forma name, so we don’t need to post the form

A simple if will handle this:A simple if will handle this:If Request.Form("name") = "" ThenIf Request.Form("name") = "" Then

Page 59: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

<h3>Sign Our Guestbook:</h3><form action="guestbook.asp" method="post"><table>

<tr><th align="right">Name:</td><td><input type="text" name="name"

size="15"></input></td></tr>

</table><input type="submit" value="Sign Guestbook!"></input></form>

Page 60: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

The form for the guest book is quite The form for the guest book is quite straight forwardstraight forward

After displaying the form we need to add After displaying the form we need to add the names in the guest bookthe names in the guest book

To do this we open the guestbook.txt fileTo do this we open the guestbook.txt file Read the file one line at a time and add Read the file one line at a time and add

each line to the page we are constructingeach line to the page we are constructing

Page 61: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

' Create an instance of the FileSystemObjectSet objFSO = Server.CreateObject("Scripting.FileSystemObject")' Open the TextFile (FileName, ForReading, AllowCreation)Set objFile = objFSO.OpenTextFile(strFile, 1, True)

Do While Not objFile.AtEndOfStreamresponse.write objFile.ReadLine & vbCrLf

Loop

Set objFile = NothingSet objFSO = Nothing

Page 62: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

To read the file we first need to create a To read the file we first need to create a file system objectfile system object

We then use this object to open the text We then use this object to open the text file with the names in itfile with the names in it

We then loop through the file, sending it We then loop through the file, sending it one line at a time to the web pageone line at a time to the web page

Finally we set the two object to nothing so Finally we set the two object to nothing so they will be closedthey will be closed

Page 63: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

In the second part the file is opened using In the second part the file is opened using basically the same techniquebasically the same technique

The name is then added to the file, but The name is then added to the file, but when we do this we add html formatting, when we do this we add html formatting, so we can just copy the line directly to the so we can just copy the line directly to the web page web page

We also ensure that the name is properly We also ensure that the name is properly encoded for htmlencoded for html

Page 64: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

' Create an instance of the FileSystemObjectSet objFSO = Server.CreateObject("Scripting.FileSystemObject")' Open the TextFile (FileName, ForAppending, AllowCreation)Set objFile = objFSO.OpenTextFile(strFile, 8, True)

objFile.Write "<strong>"objFile.Write Server.HTMLEncode(Request.Form("name"))objFile.Write "</strong><br/> "objFile.WriteLine ""

' Close the file and dispose of our objectsobjFile.CloseSet objFile = NothingSet objFSO = Nothing

Page 65: Developing Mobile Applications Mark Green School of Creative Media

Guest BookGuest Book

The final thing we need to do is inform the user The final thing we need to do is inform the user that his or her name has been addedthat his or her name has been added

Also provide a link for going back to the guest Also provide a link for going back to the guest bookbook

<h3>Your comments have been written to the file!</h3><h3>Your comments have been written to the file!</h3>

<a href="guestbook.asp">Back to the guestbook</a><a href="guestbook.asp">Back to the guestbook</a>

Page 66: Developing Mobile Applications Mark Green School of Creative Media

ASPASP

There are a number of other things that There are a number of other things that can be done with ASPcan be done with ASP

For example its possible to send mail from For example its possible to send mail from an ASP page, collect the information for an ASP page, collect the information for the email from a formthe email from a form

It is also possible to redirect the browser to It is also possible to redirect the browser to another page, or include content based on another page, or include content based on the type of browser or user inputthe type of browser or user input

Page 67: Developing Mobile Applications Mark Green School of Creative Media

ResourcesResources

There are a number of web sites that have There are a number of web sites that have information on ASPinformation on ASP

One of the better sites is:One of the better sites is:www.asp101.comwww.asp101.com

Page 68: Developing Mobile Applications Mark Green School of Creative Media

Ring TonesRing Tones

With almost everyone having a mobile With almost everyone having a mobile phone people want some way to phone people want some way to customize their phone, make it differentcustomize their phone, make it different

Can change physical appearance by Can change physical appearance by adding covers, etcadding covers, etc

One of the most popular customization is One of the most popular customization is ring tones, something that be heard and is ring tones, something that be heard and is obviousobvious

Page 69: Developing Mobile Applications Mark Green School of Creative Media

Ring TonesRing Tones

Now big business, one of the most Now big business, one of the most profitable mobile data servicesprofitable mobile data services

Becoming a multi $B industry, to the Becoming a multi $B industry, to the outsider really doesn’t look like it, but:outsider really doesn’t look like it, but: Many people have phones, many can add Many people have phones, many can add

ring tones – easy to do and understandring tones – easy to do and understand Each ring tone costs around $15Each ring tone costs around $15 Carrier makes $1 - $3 off of each ring tone Carrier makes $1 - $3 off of each ring tone

downloaddownload

Page 70: Developing Mobile Applications Mark Green School of Creative Media

Ring TonesRing Tones

Page 71: Developing Mobile Applications Mark Green School of Creative Media

Ring TonesRing Tones

Page 72: Developing Mobile Applications Mark Green School of Creative Media

Ring TonesRing Tones

Music industry looking at ring tones as Music industry looking at ring tones as replacement for singles and radioreplacement for singles and radio

Old model:Old model: A few singles produced from each albumA few singles produced from each album Singles played on radio, often before album Singles played on radio, often before album

releasedreleased Requests and sales generate hit statusRequests and sales generate hit status Used to generate sales for the albumUsed to generate sales for the album

Page 73: Developing Mobile Applications Mark Green School of Creative Media

Ring TonesRing Tones

Radio industry in trouble, with Internet Radio industry in trouble, with Internet hard to measure, sales of singles has hard to measure, sales of singles has disappeared, no 45 rpm recordsdisappeared, no 45 rpm records

But, can easily measure number of ring But, can easily measure number of ring tone downloadstone downloads

With increasing audio quality, ring tones With increasing audio quality, ring tones could sound as good as radiocould sound as good as radio

Record industry seriously considering Record industry seriously considering themthem

Page 74: Developing Mobile Applications Mark Green School of Creative Media

Ring TonesRing Tones

Important considerations:Important considerations: Song are relatively short, 2 or 3 minutesSong are relatively short, 2 or 3 minutes Ideal mobile content, easy to consume on the Ideal mobile content, easy to consume on the

roadroad Popular for a short period of time, phone has Popular for a short period of time, phone has

limited storage, can be discarded when next limited storage, can be discarded when next hit comes alonghit comes along

Download both song and ring tone based Download both song and ring tone based on song, what a package!on song, what a package!

Page 75: Developing Mobile Applications Mark Green School of Creative Media

TechnologyTechnology

Several technologies for ring tones have Several technologies for ring tones have been developed over the yearsbeen developed over the years

Get more complex as phones gain more Get more complex as phones gain more capabilitiescapabilities

Early ring tones were monophonic (one Early ring tones were monophonic (one note at a time) note at a time)

Sent to the phone over SMS, so they Sent to the phone over SMS, so they couldn’t be very longcouldn’t be very long

Page 76: Developing Mobile Applications Mark Green School of Creative Media

MonophonicMonophonic

Encoding of the ring tone is quite simple, Encoding of the ring tone is quite simple, in some ways it resembles a very simple in some ways it resembles a very simple version of Midiversion of Midi

A small set of instructions, the common A small set of instructions, the common ones are:ones are: TempoTempo NoteNote ScaleScale PausePause

Page 77: Developing Mobile Applications Mark Green School of Creative Media

MonophonicMonophonic

Notes are specified as their position within Notes are specified as their position within the octave, number between 0 and 12the octave, number between 0 and 12

Durations specified in terms of standard Durations specified in terms of standard musical notation, not in terms of secondsmusical notation, not in terms of seconds

Scale command used to change the Scale command used to change the octave usedoctave used

Pause is used to produce a restPause is used to produce a rest Can define repeating patternsCan define repeating patterns

Page 78: Developing Mobile Applications Mark Green School of Creative Media

TechnologyTechnology

Most phones now have polyphonic (more Most phones now have polyphonic (more than one note at a time) ring tonesthan one note at a time) ring tones

Still need to worry about amount of Still need to worry about amount of memory required to store ring tones, so memory required to store ring tones, so can’t do sampled soundscan’t do sampled sounds

Need a more compact formatNeed a more compact format This opens up a lot of possibilities, can This opens up a lot of possibilities, can

have much more sophisticated soundshave much more sophisticated sounds

Page 79: Developing Mobile Applications Mark Green School of Creative Media

TechnologyTechnology

Midi is one of the standards used for Midi is one of the standards used for polyphonic ring tonespolyphonic ring tones

Reasonably compact representation, only Reasonably compact representation, only a few bytes per notea few bytes per note

Well known format:Well known format: Many composers are familiar with it, can Many composers are familiar with it, can

easily produce contenteasily produce content Many composition tools are already available, Many composition tools are already available,

don’t need to create new onesdon’t need to create new ones

Page 80: Developing Mobile Applications Mark Green School of Creative Media

TechnologyTechnology

Problem: different phones have different Problem: different phones have different capabilitiescapabilities Size of ring tones, this is obvious and easy to Size of ring tones, this is obvious and easy to

controlcontrol Level of polyphony, number of notes that can Level of polyphony, number of notes that can

be played at the same time, this is the real be played at the same time, this is the real problemproblem

PC Midi synthesizers can play at least 64 PC Midi synthesizers can play at least 64 notes at the same time, not the case with notes at the same time, not the case with phonesphones

Page 81: Developing Mobile Applications Mark Green School of Creative Media

TechnologyTechnology

First polyphonic phones could only play 4 First polyphonic phones could only play 4 notes at a timenotes at a time

Second generation phones could play 16 Second generation phones could play 16 notes at a timenotes at a time

Some current phones can play 24 or more Some current phones can play 24 or more notes at the same timenotes at the same time

Nice to see the evolution of capabilities, Nice to see the evolution of capabilities, but this causes a problembut this causes a problem

Page 82: Developing Mobile Applications Mark Green School of Creative Media

TechnologyTechnology

If we want to support the widest range of If we want to support the widest range of phones, restrict to 4 note polyphonyphones, restrict to 4 note polyphony

But, this wastes the capabilities of other But, this wastes the capabilities of other phones, we could produce much better phones, we could produce much better ring tones for these phonesring tones for these phones

If we aim for more polyphony it could If we aim for more polyphony it could sound bad on low end phonessound bad on low end phones

Won’t be able to play all the notesWon’t be able to play all the notes

Page 83: Developing Mobile Applications Mark Green School of Creative Media

SP-MidiSP-Midi

Would like our ring tones to sound good Would like our ring tones to sound good on all phoneson all phones

Don’t want to produce separate versions Don’t want to produce separate versions for each type of phone for each type of phone

May not be possible to determine phone May not be possible to determine phone capabilities before downloadcapabilities before download

Scalable Polyphonic Midi is one solution to Scalable Polyphonic Midi is one solution to this problemthis problem

Page 84: Developing Mobile Applications Mark Green School of Creative Media

SP-MidiSP-Midi

If I compose a ring tone assuming 16 level If I compose a ring tone assuming 16 level polyphony and someone plays it on a polyphony and someone plays it on a phone with 4 level polyphony there will be phone with 4 level polyphony there will be problemsproblems

Phone can only play 4 notes at a time, but Phone can only play 4 notes at a time, but the ring tone could need 16the ring tone could need 16

If we are already playing 4 notes and the If we are already playing 4 notes and the ring tone asks for a fifth note what will ring tone asks for a fifth note what will happen?happen?

Page 85: Developing Mobile Applications Mark Green School of Creative Media

SP-MidiSP-Midi

Could do one of two things:Could do one of two things: Could select one of the current notes, stop Could select one of the current notes, stop

playing it and start playing the new noteplaying it and start playing the new note Ignore the new note and keep playing the Ignore the new note and keep playing the

current 4 notescurrent 4 notes Both of these solutions could cause Both of these solutions could cause

problems, depending upon the role of the problems, depending upon the role of the new notenew note

Need to know how important it isNeed to know how important it is

Page 86: Developing Mobile Applications Mark Green School of Creative Media

SP-MidiSP-Midi

If the new note is part of the melody, want If the new note is part of the melody, want to stop one of the current notes and play to stop one of the current notes and play the new onethe new one

If the new note isn’t as important as the If the new note isn’t as important as the current notes, then want to keep playing current notes, then want to keep playing themthem

Don’t want to stop an important melody Don’t want to stop an important melody note for one that isn’t as importantnote for one that isn’t as important

Page 87: Developing Mobile Applications Mark Green School of Creative Media

SP-MidiSP-Midi

The phone doesn’t know which notes are The phone doesn’t know which notes are important, it has no musical knowledgeimportant, it has no musical knowledge

Phone is likely to play the wrong notes, Phone is likely to play the wrong notes, ring tone will sound badring tone will sound bad

SP-Midi provides a solution to this problemSP-Midi provides a solution to this problem It gives the composer several ways of It gives the composer several ways of

indicating the notes that should be played indicating the notes that should be played on less capable phoneson less capable phones

Page 88: Developing Mobile Applications Mark Green School of Creative Media

SP-MidiSP-Midi

Priority scheme is based on channelsPriority scheme is based on channels Recall: a Midi channel is like an Recall: a Midi channel is like an

instrument, all the notes on the same instrument, all the notes on the same channel played by the same instrumentchannel played by the same instrument

Can have several simultaneous notes on Can have several simultaneous notes on the same channelthe same channel

First, each channel is assigned a priority First, each channel is assigned a priority by the composerby the composer

Page 89: Developing Mobile Applications Mark Green School of Creative Media

SP-MidiSP-Midi

Composer puts the most important notes Composer puts the most important notes in the channel with the highest priorityin the channel with the highest priority

For example, the melody would be placed For example, the melody would be placed in the highest priority channelin the highest priority channel

The least important parts of the song The least important parts of the song would be placed in the channels with the would be placed in the channels with the lowest prioritieslowest priorities

Composer must carefully design the song Composer must carefully design the song so the most important parts are playedso the most important parts are played

Page 90: Developing Mobile Applications Mark Green School of Creative Media

SP-MidiSP-Midi

This solves part of the problemThis solves part of the problem The phone will always play the most The phone will always play the most

important notes, but it could still sound badimportant notes, but it could still sound bad If a low priority note is playing and a more If a low priority note is playing and a more

important one comes along, the lower important one comes along, the lower priority note will immediately stop playingpriority note will immediately stop playing

This can be quite noticeable, it would be This can be quite noticeable, it would be better if the lower priority note didn’t startbetter if the lower priority note didn’t start

Page 91: Developing Mobile Applications Mark Green School of Creative Media

SP-MidiSP-Midi

We need some way of saying – don’t play We need some way of saying – don’t play these channels, even if at some point these channels, even if at some point there are resources for themthere are resources for them

The MIP (Maximum Instantaneous The MIP (Maximum Instantaneous Polyphony) Midi message is used to solve Polyphony) Midi message is used to solve this problemthis problem

Matches the channels to the polyphony Matches the channels to the polyphony level of the phonelevel of the phone

Page 92: Developing Mobile Applications Mark Green School of Creative Media

SP-MidiSP-Midi

For each polyphony level the MIP For each polyphony level the MIP message gives the set of channels that message gives the set of channels that can be playedcan be played

A 4 note phone can then pick the set of A 4 note phone can then pick the set of channels that will play at most 4 notes at channels that will play at most 4 notes at the same timethe same time

The phone will ignore all of the other The phone will ignore all of the other channels, so the ring tone will sound channels, so the ring tone will sound reasonable on any phonereasonable on any phone

Page 93: Developing Mobile Applications Mark Green School of Creative Media

SP-MidiSP-Midi

SP-Midi ring tones can either be delivered SP-Midi ring tones can either be delivered by MMS or WAPby MMS or WAP

With MMS the phone sends an SMS With MMS the phone sends an SMS message to the server requesting a message to the server requesting a particular ring toneparticular ring tone

The server responds with an MMS The server responds with an MMS message containing the ring tonemessage containing the ring tone

The phone adds the ring tone to its listThe phone adds the ring tone to its list

Page 94: Developing Mobile Applications Mark Green School of Creative Media

SP-MidiSP-Midi

In the case of WAP delivery, the user In the case of WAP delivery, the user browses to the web page with the ring browses to the web page with the ring tonestones

Selecting a link will download a ring tone Selecting a link will download a ring tone using a standard WAP responseusing a standard WAP response

Similar to a normal web page downloadSimilar to a normal web page download Ring tone can then be played and added Ring tone can then be played and added

to the list of ring tones for the phoneto the list of ring tones for the phone

Page 95: Developing Mobile Applications Mark Green School of Creative Media

TechnologyTechnology

Now that phones have more memory its Now that phones have more memory its possible to use sampled ring tonespossible to use sampled ring tones

This is quite recent and only a small This is quite recent and only a small number of phones support itnumber of phones support it

True Tone ring tones are based on the True Tone ring tones are based on the AMR-WB audio formatAMR-WB audio format

This format was originally designed for This format was originally designed for speech, but can be used for musicspeech, but can be used for music

Page 96: Developing Mobile Applications Mark Green School of Creative Media

True ToneTrue Tone

AMR-WB requires 1-3 kBytes per second AMR-WB requires 1-3 kBytes per second of soundof sound

Most 2.5G services restricted downloads Most 2.5G services restricted downloads to between 30 and 100 kBytesto between 30 and 100 kBytes

The maximum is about a minute of good The maximum is about a minute of good quality sound, but could be as little as 10 quality sound, but could be as little as 10 secondsseconds

This is not a problem with 3G phonesThis is not a problem with 3G phones

Page 97: Developing Mobile Applications Mark Green School of Creative Media

True ToneTrue Tone

Why use True Tone ring tones:Why use True Tone ring tones: Can have a much wider range of soundsCan have a much wider range of sounds Can use existing sounds/music that is already Can use existing sounds/music that is already

is a sampled formatis a sampled format Easy to produce by converting existing sound Easy to produce by converting existing sound

filesfiles Can do novelty ring tones, like people talking Can do novelty ring tones, like people talking

or sound effectsor sound effects

Page 98: Developing Mobile Applications Mark Green School of Creative Media

True ToneTrue Tone

Can be downloaded using either MMS or Can be downloaded using either MMS or WAP, the same as SP-Midi ring tonesWAP, the same as SP-Midi ring tones

Fairly new, and not a very large market yet Fairly new, and not a very large market yet so they are not very popularso they are not very popular

Relatively slow download on 2.5G, better Relatively slow download on 2.5G, better on 3G, but they might define a different set on 3G, but they might define a different set of standards for ring tonesof standards for ring tones

Page 99: Developing Mobile Applications Mark Green School of Creative Media

Composing Ring TonesComposing Ring Tones

It’s a mobile phone, not a high end home It’s a mobile phone, not a high end home stereo system!stereo system!

Phones have a small speaker, not very Phones have a small speaker, not very good audio qualitygood audio quality

Only have good quality when headphones Only have good quality when headphones are usedare used

Stay in the narrow frequency range used Stay in the narrow frequency range used for voice communicationsfor voice communications

Page 100: Developing Mobile Applications Mark Green School of Creative Media

Composing Ring TonesComposing Ring Tones

Avoid high and low frequenciesAvoid high and low frequencies Use instruments that have a solid sound, Use instruments that have a solid sound,

not a weak onenot a weak one Phones often used in noisy environments, Phones often used in noisy environments,

the ring must be heard!the ring must be heard! Need to have enough volume in the ring Need to have enough volume in the ring

tone, no quiet sweet melodiestone, no quiet sweet melodies Be a bit (a lot??) annoyingBe a bit (a lot??) annoying

Page 101: Developing Mobile Applications Mark Green School of Creative Media

Composing Ring TonesComposing Ring Tones

Remember that a ring tone repeatsRemember that a ring tone repeats The phone doesn’t ring just once, it can The phone doesn’t ring just once, it can

ring several timesring several times The end of the ring tone must flow into its The end of the ring tone must flow into its

startstart Better to use a short riff than a longer Better to use a short riff than a longer

sequence, it will repeat bettersequence, it will repeat better

Page 102: Developing Mobile Applications Mark Green School of Creative Media

Composing Ring TonesComposing Ring Tones

There are several tricks that can be done There are several tricks that can be done with SP-Midi ring toneswith SP-Midi ring tones

Volume can be increased by repeating a Volume can be increased by repeating a channel, particularly if the channel is channel, particularly if the channel is played by a weak instrumentplayed by a weak instrument

This is easy to do in a sequencer, just This is easy to do in a sequencer, just duplicate the trackduplicate the track

Repeating more than once probably won’t Repeating more than once probably won’t help muchhelp much

Page 103: Developing Mobile Applications Mark Green School of Creative Media

Composing Ring TonesComposing Ring Tones

Duplicating tracks can be used for several Duplicating tracks can be used for several other effectsother effects

Using a small time delay will produce an Using a small time delay will produce an echo like effectecho like effect

This will give the ring tone more depth and This will give the ring tone more depth and partially compensate for small speakerspartially compensate for small speakers

Slightly detuning the second track gives an Slightly detuning the second track gives an interesting, if not annoying effectinteresting, if not annoying effect

Page 104: Developing Mobile Applications Mark Green School of Creative Media

Composing Ring TonesComposing Ring Tones

Remember to try the ring tones on real Remember to try the ring tones on real phonesphones

What sounds good on your computer may What sounds good on your computer may not sound good on a phone, computers not sound good on a phone, computers have better speakers and sound cardshave better speakers and sound cards

Some ring tone composing software can Some ring tone composing software can simulate phone speakers, giving the simulate phone speakers, giving the composer some idea of what it will sound composer some idea of what it will sound like on a phonelike on a phone

Page 105: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

Digital Rights Management – protecting Digital Rights Management – protecting your content from piratesyour content from pirates

If you can download content for your If you can download content for your phone, what’s to stop people from pirating phone, what’s to stop people from pirating it, making illegal copiesit, making illegal copies

Set up their own web site for ring tones Set up their own web site for ring tones based on copied contentbased on copied content

Major concern in the content industryMajor concern in the content industry

Page 106: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

The content industry was too late for the The content industry was too late for the Internet, pirating well established before Internet, pirating well established before they knew about the Internetthey knew about the Internet

Don’t want to be left behind with mobile Don’t want to be left behind with mobile mediamedia

Content industry now playing an active Content industry now playing an active role in media distribution technology role in media distribution technology before it is releasedbefore it is released

Page 107: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

Piracy is probably not as large a threat for Piracy is probably not as large a threat for mobile mediamobile media

The technology makes piracy more difficult The technology makes piracy more difficult and less profitableand less profitable

Download cost is relatively low, so there Download cost is relatively low, so there isn’t much of a profit margin for pirates, isn’t much of a profit margin for pirates, their costs will be similar to the developerstheir costs will be similar to the developers

More risky, easier to get caughtMore risky, easier to get caught

Page 108: Developing Mobile Applications Mark Green School of Creative Media

Mobile vs. InternetMobile vs. Internet

Small number of Small number of carrierscarriers

Pirates in competition Pirates in competition with carrierswith carriers

Pirates have negative Pirates have negative impact on revenueimpact on revenue

Pirates are relatively Pirates are relatively easy to blockeasy to block

Large number of Large number of carrierscarriers

No competition No competition between pirates and between pirates and carrierscarriers

Pirates have a Pirates have a positive impact on positive impact on revenuerevenue

Pirates are very hard Pirates are very hard to blockto block

Page 109: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

Unlike the internet, pirates are in Unlike the internet, pirates are in competition with carrierscompetition with carriers

Carriers get a portion of the revenue from Carriers get a portion of the revenue from content, if content is pirated carrier loses content, if content is pirated carrier loses this revenuethis revenue

With very few carriers its quite easy to With very few carriers its quite easy to block a pirate, don’t allow requests to their block a pirate, don’t allow requests to their web siteweb site

Page 110: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

Distribution over the air not possible for Distribution over the air not possible for piratespirates

This leaves burning CDs and downloading This leaves burning CDs and downloading from customer’s computerfrom customer’s computer

Since most content downloads are around Since most content downloads are around $15, pirates will need to charge around $5 $15, pirates will need to charge around $5 or $6 to get sales, customers won’t pay or $6 to get sales, customers won’t pay $25 for the pirated version$25 for the pirated version

No profit marginNo profit margin

Page 111: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

Unlike PCs, mobile phones are hard to Unlike PCs, mobile phones are hard to hack, but not impossiblehack, but not impossible

Only a few manufacturers, cannot be Only a few manufacturers, cannot be custom builtcustom built

Cannot install your own operating Cannot install your own operating software, done by manufacturersoftware, done by manufacturer

Much tighter control over what can be Much tighter control over what can be done on the phonedone on the phone

Page 112: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

The OMA (Open Mobile Alliance) has The OMA (Open Mobile Alliance) has defined three methods of DRM, only the defined three methods of DRM, only the first method is widely usedfirst method is widely used

Forward-lockForward-lock prevents content from being prevents content from being forwarded to another phoneforwarded to another phone

A user can download the content and play A user can download the content and play the contentthe content

The content can be sent to another phone, The content can be sent to another phone, but that phone cannot view the contentbut that phone cannot view the content

Page 113: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

On download the content is encrypted with On download the content is encrypted with a key that is unique to the phonea key that is unique to the phone

Only the phone that it was downloaded to Only the phone that it was downloaded to has the key, so it can only be viewed on has the key, so it can only be viewed on that phonethat phone

The content is only stored in the encrypted The content is only stored in the encrypted form, it is never in plain formform, it is never in plain form

This works for all types of content, both This works for all types of content, both streaming and downloadstreaming and download

Page 114: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

There is one hole in this approach, for There is one hole in this approach, for Java applications the installation package Java applications the installation package isn’t encryptedisn’t encrypted

The encryption happens after the The encryption happens after the application is installedapplication is installed

A user can forward the installation A user can forward the installation package to another phone, and the package to another phone, and the application could be potentially installed application could be potentially installed therethere

Page 115: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

There are several ways around this, There are several ways around this, including getting a key before the package including getting a key before the package can be installedcan be installed

Combined DeliveryCombined Delivery – both the content and – both the content and the rules and keys for accessing the the rules and keys for accessing the content are downloaded togethercontent are downloaded together

Different rules can be applied to different Different rules can be applied to different parts of the contentparts of the content

Page 116: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

User could be able to preview the content User could be able to preview the content without paying, but would need to obtain a without paying, but would need to obtain a key to view the entire contentkey to view the entire content

More flexible than forward-lock, can give More flexible than forward-lock, can give different levels of access to different parts different levels of access to different parts of the contentof the content

Forward-lock is all or nothing, can’t give Forward-lock is all or nothing, can’t give selective accessselective access

Page 117: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

Separate DeliverySeparate Delivery separates the content separates the content from the keys and access rights, they are from the keys and access rights, they are downloaded as two separate packagesdownloaded as two separate packages

The most secure and flexible of the three The most secure and flexible of the three methodsmethods

User must have both parts to access the User must have both parts to access the content, the content part can be freely content, the content part can be freely distributed, but cannot be accessed distributed, but cannot be accessed without the second partwithout the second part

Page 118: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

Since the access rights are separate they Since the access rights are separate they can be time dependent, for example view can be time dependent, for example view once, or view for a weekonce, or view for a week

The content developer can rely on multiple The content developer can rely on multiple channels to distribute the content, even channels to distribute the content, even piratespirates

They control distribution of the access They control distribution of the access rights, a much smaller downloadrights, a much smaller download

Page 119: Developing Mobile Applications Mark Green School of Creative Media

DRMDRM

This is not a consumer friendly as the This is not a consumer friendly as the other approachesother approaches

Forward-lock is available now on newer Forward-lock is available now on newer phones, but the other two have not been phones, but the other two have not been widely deployed yetwidely deployed yet

Free tools available for adding forward-Free tools available for adding forward-lock to content, can be done now with very lock to content, can be done now with very little worklittle work

Page 120: Developing Mobile Applications Mark Green School of Creative Media

MMSMMS

So far treated SMS and MMS as basically So far treated SMS and MMS as basically the same, but this really isn’t the casethe same, but this really isn’t the case

There are two main differences:There are two main differences: Message transfer mechanismMessage transfer mechanism Message contentMessage content

We are mainly interested in message We are mainly interested in message content, but will briefly look at transfer as content, but will briefly look at transfer as wellwell

Page 121: Developing Mobile Applications Mark Green School of Creative Media

Message TransferMessage Transfer

Unlike an SMS a MMS message is not Unlike an SMS a MMS message is not delivered immediately to a phonedelivered immediately to a phone

Instead the phone is sent a message Instead the phone is sent a message notification, telling the phone that a notification, telling the phone that a message is waitingmessage is waiting

The message notification contains a URL The message notification contains a URL that tells the phone how to retrieve the that tells the phone how to retrieve the messagemessage

Page 122: Developing Mobile Applications Mark Green School of Creative Media

Message TransferMessage Transfer

If the user wants the message, they can If the user wants the message, they can tell the phone to retrieve ittell the phone to retrieve it

The user can also ignore the message, The user can also ignore the message, this can save money since the messages this can save money since the messages could be largecould be large

Message retrieval is usually over http, but Message retrieval is usually over http, but other protocols could be usedother protocols could be used

Page 123: Developing Mobile Applications Mark Green School of Creative Media

Message TransferMessage Transfer

Similarly when you send an MMS, the Similarly when you send an MMS, the whole message goes to the MMSC, but whole message goes to the MMSC, but only the notification goes to the person only the notification goes to the person you sent it toyou sent it to

They can then decide to download your They can then decide to download your MMS or ignore itMMS or ignore it

A receive notification may not mean that A receive notification may not mean that the person has viewed the message, only the person has viewed the message, only the notificationthe notification

Page 124: Developing Mobile Applications Mark Green School of Creative Media

Message ContentMessage Content

An MMS message can have a single An MMS message can have a single media item, a picture from the phone’s media item, a picture from the phone’s cameracamera

This is typically the case when you send This is typically the case when you send an MMS from your phonean MMS from your phone

In other cases it can have multiple items, In other cases it can have multiple items, in this case there needs to be presentation in this case there needs to be presentation information as wellinformation as well

Page 125: Developing Mobile Applications Mark Green School of Creative Media

Message ContentMessage Content

A message produced by a service will A message produced by a service will have multiple items, for example text, have multiple items, for example text, image and sound, in the same messageimage and sound, in the same message

If there are multiple images, or videos, If there are multiple images, or videos, where do we put them on the screen?where do we put them on the screen?

What is the timing of the individual What is the timing of the individual components?components?

This is handled by the presentation part of This is handled by the presentation part of the messagethe message

Page 126: Developing Mobile Applications Mark Green School of Creative Media

PresentationPresentation

An MMS message consists of multiple An MMS message consists of multiple parts:parts: The presentation componentThe presentation component The individual media itemsThe individual media items

SMIL, Synchronized Multimedia SMIL, Synchronized Multimedia Integration Language is used for the Integration Language is used for the presentation componentpresentation component

A standard multimedia language, not A standard multimedia language, not restricted to phonesrestricted to phones

Page 127: Developing Mobile Applications Mark Green School of Creative Media

SMILSMIL

SMIL description divided into two parts:SMIL description divided into two parts: Head – the screen layout and transitions, the Head – the screen layout and transitions, the

spatial part of the presentationspatial part of the presentation Body – the timing and duration of the Body – the timing and duration of the

individual media pieces, the temporal part of individual media pieces, the temporal part of the presentationthe presentation

The head divides the screen into a number The head divides the screen into a number of regions, regions can overlap, define a of regions, regions can overlap, define a stacking orderstacking order

Page 128: Developing Mobile Applications Mark Green School of Creative Media

SMILSMIL

Region size and position can be specified Region size and position can be specified in pixels, or percentage of the screen sizein pixels, or percentage of the screen size

Can specify both the size and position of a Can specify both the size and position of a regionregion

Transitions can be used at the beginning Transitions can be used at the beginning or end of a media itemor end of a media item

Transitions usually applied to text and Transitions usually applied to text and images, don’t work with videoimages, don’t work with video

Page 129: Developing Mobile Applications Mark Green School of Creative Media

SMILSMIL

The body specifies the items to be The body specifies the items to be displayed, give name of media and region displayed, give name of media and region where its displayedwhere its displayed

Also give timing information, can have a Also give timing information, can have a duration for each item, and a start timeduration for each item, and a start time

Can also have in and out transitions for Can also have in and out transitions for each itemeach item

Page 130: Developing Mobile Applications Mark Green School of Creative Media

SMILSMIL

With multiple items can be displayed in With multiple items can be displayed in parallel of sequentiallyparallel of sequentially

Grouping items are used for thisGrouping items are used for this In a <par> group all the items are In a <par> group all the items are

displayed in paralleldisplayed in parallel In a <seq> group they are displayed one In a <seq> group they are displayed one

after the otherafter the other Can put a <par> in a <seq> and visa versaCan put a <par> in a <seq> and visa versa

Page 131: Developing Mobile Applications Mark Green School of Creative Media

SMILSMIL

SMIL is an XML based language, so it SMIL is an XML based language, so it looks like HTMLlooks like HTML

In the lab we will look at the software that In the lab we will look at the software that can be used to create MMS messages can be used to create MMS messages and look at some examplesand look at some examples