WebAPI/WebMMS: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 1: Line 1:
= Overview =
= Overview =


MMS messages  
On the surface, MMS messages are very similar to multipart HTML emails. One part is responsible for the layout of the message, though MMS uses SMIL rather than HTML. The other parts are attachments, such as text, picture, video, and sound files. Much like in multipart


= API =
= API =
Line 29: Line 27:
     readonly attribute MmsAttachmentStorage attachments;
     readonly attribute MmsAttachmentStorage attachments;
      
      
    /**
    * "unfetched"
    */
     readonly attribute DOMString            state;
     readonly attribute DOMString            state;
     DOMRequest fetch();
     DOMRequest fetch();
Line 35: Line 36:
   }
   }
    
    
  /**
  * This object implements a mapping to look up attachments by their name.
  *
  *  var text = message.attachments["text.txt"];
  *  message.attachments["movie.mov"] = new MmsAttachment([data], {type: "application/video"});
  *  delete message.attachments["picture.png"];
  */
   interface MmsAttachmentStorage
   interface MmsAttachmentStorage
   {
   {
Line 42: Line 50:
   }
   }
    
    
  /**
  * MmsAttachment constructor (cf. Blob constructor)
  */
  MmsAttachment MmsAttachment(
    [optional] Array parts,
    [optional] BlobPropertyBag properties
  );
 
  /**
  * MMS attachments extend the DOM Blob type, akin to how File extends Blob.
  */
   [Constructor]
   [Constructor]
   interface MmsAttachment
   interface MmsAttachment : Blob
   {
   {
    /**
    * Name of the attachment as it is referenced within the SMIL document (cf. File::name)
    */
     readonly attribute DOMString name;
     readonly attribute DOMString name;
     readonly attribute DOMString contentType;
 
     /**
    * An absolute URI under which User Agent makes the attachment available for download.
    * This is provided so that the data does not have to be loaded into memory first, but
    * can directly be linked to from an <img>, <video>, or <audio> element.
    */
     readonly attribute DOMString uri;
     readonly attribute DOMString uri;
    /**
    * Inherited from Blob. See https://developer.mozilla.org/en/DOM/Blob
    */
    readonly attribute unsigned long long size;
    readonly attribute DOMString type;
   }
   }
= Example =


== Receiving an MMS ==
== Receiving an MMS ==
Line 72: Line 107:
== Sending an MMS ==
== Sending an MMS ==


   var message = new MmsMessage(receiver);
   var smil = "<smil><body><par><video src="lolcat.mov"/></par></body></smil>";
   var doc = message.contentDocument;
  var parser = new DOMParser();
   var par = doc.createElement("par");
   var doc = parser.parseFromString(smil, "application/smil");
   doc.appendChild(par);
 
 
   var message = new MmsMessage(recipient, doc);
   message.attachments["lolcat.mov"] = new MmsAttchment("lolcat.mov", "application/video", videoData);
 
   navigator.mms.send(message);
   navigator.mms.send(message);
= Example =
canmove, Confirmed users
725

edits

Navigation menu