WebAPI/WebMMS: Difference between revisions

no edit summary
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 3: Line 3:
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 emails, the attachments have "file names" and are referred to by those from the presentation part.
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 emails, the attachments have "file names" and are referred to by those from the presentation part.


The API proposal below tries to reuse as many existing Web technologies as applicable. The SMIL document is exposed as a [https://developer.mozilla.org/en/DOM:document DOM document] and the attachments as [https://developer.mozilla.org/en/DOM/Blob Blob] objects (or, rather, an extension thereof, akin to how [https://developer.mozilla.org/en/DOM/File File] is an extension of Blob). On a User Agent capable of rendering SMIL, the web application may simply render the DOM right away. On other User Agents, it may use XSLT or some other method to convert SMIL to HTML.
The API proposal below tries to reuse as many existing Web technologies as applicable. The SMIL document is exposed as a [https://developer.mozilla.org/en/DOM:document DOM document] and the attachments as [https://developer.mozilla.org/en/DOM/Blob Blob] objects. On a User Agent capable of rendering SMIL, the web application may simply render the DOM right away. On other User Agents, it may use XSLT or some other method to convert SMIL to HTML.


To read the attachments, the web application may use the [https://developer.mozilla.org/en/DOM/FileReader FileReader] API. However, it's not that useful or efficient to have image/audio/video data in memory (e.g. as a typed array). For display purposes the web application just needs a URI that resolves to the data, so that it can point to it in a <video>, <audio>, <img> element. In the simplest case this could be a data: URI, but for large data it might just want to stream the data directly from a file on the disk. (This would be a generally useful feature to provide for all blobs, e.g. when storing multimedia data in IndexedDB.)
To read the attachments, the web application may use the [https://developer.mozilla.org/en/DOM/FileReader FileReader] API. However, it's not that useful or efficient to have image/audio/video data in memory (e.g. as a typed array). For display purposes the web application just needs a URI that resolves to the data, so that it can point to it in a <video>, <audio>, <img> element. This is possible with the [https://developer.mozilla.org/en/DOM/window.URL.createObjectURL window.URL] API.


= API =
= API =
Line 143: Line 143:
     <div>
     <div>
       <input type="text" id="number">
       <input type="text" id="number">
       &lt;button onclick="sendMMS()">Send</button>
       &lt;button onclick="sendMMS();">Send</button>
     &lt;/div>
     &lt;/div>
     &lt;script>
     &lt;script>
Line 161: Line 161:
   &lt;/body>
   &lt;/body>
   &lt;/html>
   &lt;/html>
[[Category:Web APIs]]
Confirmed users
1,340

edits