You Are Here:

Community: Wiki

This page was last modified on 4 July 2008, at 01:17.

How to create a SMIL message

From Forum Nokia Wiki

SMIL stands for Synchronized Multimedia Integration Language.SMIL allows integrating a set of independent multimedia objects into a synchronized multimedia presentation. Using SMIL, an author can

  1. describe the temporal behavior of the presentation
  2. describe the layout of the presentation on a screen
  3. associate hyperlinks with media objects

SAMPLE CODE

The code snippet to create a SMIL presentation when creating a MMS message is below:

TBool CMMSExampleContainer::CreateNewMessageL()
{
CMsvEntry* entry = CMsvEntry::NewL(*iSession, KMsvGlobalOutBoxIndexEntryId,
TMsvSelectionOrdering());
CleanupStack::PushL(entry);
 
// Set context to the parent folder (Outbox)
iMmsMtm->SwitchCurrentEntryL( entry->EntryId() );
 
// Create new message in the Outbox and set it as the current context.
#ifdef __SERIES60_3X__ //3rd edition onwards
iMmsMtm->CreateMessageL( iMmsMtm->DefaultServiceL() );
#else//1st and 2nd edition
iMmsMtm->CreateMessageL( iMmsMtm->DefaultSettingsL() );
#endif
CleanupStack::PopAndDestroy(); // entry
 
// Setting recipients
// use this to add the "To" recipients.
iMmsMtm->AddAddresseeL( _L("9841840648") );
 
//Setting message subject
_LIT(KMessageSubject, "MMS Example");
iMmsMtm->SetSubjectL(KMessageSubject);
 
// Message consists of one image
#ifndef __HARDCODED_PATHS__ //3rd and 2nd edition
TFileName attachmentFile(KPhoneRootPath);
attachmentFile.Append(KDirPictures);
TFileName fileName(KFileName);
attachmentFile.Append(KFileName);
#else//1st edition
TFileName attachmentFile(KDirPictures);
attachmentFile.Append(KFileName);
#endif
 
TMsvEntry ent = iMmsMtm->Entry().Entry();
// Set InPreparation to false
ent.SetInPreparation(EFalse);
ent.SetVisible(ETrue);
iMmsMtm->Entry().ChangeL(ent); // Commit changes
 
#ifdef __SERIES60_3X__ //adding attachment 3rd edition onwards
//Save the changes
iMmsMtm->SaveMessageL();
 
//Opening store
CMsvStore* store = iMmsMtm->Entry().EditStoreL();
CleanupStack::PushL(store);
 
RFile attachment;
//open attachment file
TInt error = attachment.Open( CCoeEnv::Static()->FsSession(), attachmentFile,
EFileShareReadersOnly | EFileRead );
CleanupClosePushL( attachment );
 
//Check that the attachment file exist.
if(error != KErrNone)
{
attachment.Close();
CleanupStack::PopAndDestroy(); // attachment
CleanupStack::PopAndDestroy(); // store
return EFalse;
}
else
{
// GIF IMAGE
//mime header
CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
CleanupStack::PushL( mimeHeaders );
mimeHeaders->SetSuggestedFilenameL(fileName);
mimeHeaders->SetContentLocationL( fileName );
// Represents a single attachment and information about the attachment
CMsvAttachment* attaInfo = CMsvAttachment::NewL( CMsvAttachment::EMsvFile );
CleanupStack::PushL( attaInfo );
//Mime Type
_LIT8(KMimeType, "image/gif");
TBufC8<20> mimeType(KMimeType);
TMsvAttachmentId attachId = KMsvNullIndexEntryId;
//Attachment file must be an public folder (e.g. c:\Data\images)
iMmsMtm->CreateAttachment2L(
*store,
attachment,
mimeType,
*mimeHeaders,
attaInfo,
attachId );
CleanupStack::Pop( attaInfo ); // attaInfo
CleanupStack::PopAndDestroy(mimeHeaders); // mimeHeaders
attachment.Close();
CleanupStack::PopAndDestroy(); // attachment
 
// PLAIN TEXT
#ifndef __HARDCODED_PATHS__ //3rd and 2nd edition
attachmentFile.Copy(KPhoneRootPath);
attachmentFile.Append(KDirPictures);
TFileName fileName2(KFileName2);
attachmentFile.Append(KFileName2);
#else//1st edition
TFileName attachmentFile(KDirPictures);
attachmentFile.Append(KFileName2);
#endif
TInt err = attachment.Open( CCoeEnv::Static()->FsSession(), attachmentFile,
EFileShareReadersOnly | EFileRead );
CleanupClosePushL( attachment );
//mime header
mimeHeaders = CMsvMimeHeaders::NewL();
CleanupStack::PushL( mimeHeaders );
mimeHeaders->SetSuggestedFilenameL(fileName2);
mimeHeaders->SetContentLocationL( fileName2 );
// Represents a single attachment and information about the attachment
attaInfo = CMsvAttachment::NewL( CMsvAttachment::EMsvFile );
CleanupStack::PushL( attaInfo );
//Mime Type
_LIT8(KMimeTypeText, "text/plain");
TBufC8<20> mimeType2(KMimeTypeText);
attachId = KMsvNullIndexEntryId;
//Attachment file must be an public folder (e.g. c:\Data\images)
iMmsMtm->CreateAttachment2L(
*store,
attachment,
mimeType2,
*mimeHeaders,
attaInfo,
attachId );
 
CleanupStack::Pop( attaInfo ); // attaInfo
CleanupStack::PopAndDestroy(mimeHeaders); // mimeHeaders
attachment.Close();
CleanupStack::PopAndDestroy(); // attachment
 
// GIF IMAGE
#ifndef __HARDCODED_PATHS__ //3rd and 2nd edition
attachmentFile.Copy(KPhoneRootPath);
attachmentFile.Append(KDirPictures);
TFileName fileName4(KFileName4);
attachmentFile.Append(KFileName4);
#else//1st edition
TFileName attachmentFile(KDirPictures);
attachmentFile.Append(KFileName2);
#endif
err = attachment.Open( CCoeEnv::Static()->FsSession(), attachmentFile,
EFileShareReadersOnly | EFileRead );
CleanupClosePushL( attachment );
//mime header
mimeHeaders = CMsvMimeHeaders::NewL();
CleanupStack::PushL( mimeHeaders );
mimeHeaders->SetSuggestedFilenameL(fileName4);
mimeHeaders->SetContentLocationL( fileName4 );
// Represents a single attachment and information about the attachment
attaInfo = CMsvAttachment::NewL( CMsvAttachment::EMsvFile );
CleanupStack::PushL( attaInfo );
attachId = KMsvNullIndexEntryId;
//Attachment file must be an public folder (e.g. c:\Data\images)
iMmsMtm->CreateAttachment2L(
*store,
attachment,
mimeType,
*mimeHeaders,
attaInfo,
attachId );
CleanupStack::Pop( attaInfo ); // attaInfo
CleanupStack::PopAndDestroy(mimeHeaders); // mimeHeaders
attachment.Close();
CleanupStack::PopAndDestroy(); // attachment
 
// SMIL FILE
#ifndef __HARDCODED_PATHS__ //3rd and 2nd edition
attachmentFile.Copy(KPhoneRootPath);
attachmentFile.Append(KDirPictures);
TFileName fileName3(KFileName3);
attachmentFile.Append(KFileName3);
#else//1st edition
TFileName attachmentFile(KDirPictures);
attachmentFile.Append(KFileName3);
#endif
attachment.Open( CCoeEnv::Static()->FsSession(), attachmentFile,
EFileShareReadersOnly | EFileRead );
CleanupClosePushL( attachment );
//mime header
mimeHeaders = CMsvMimeHeaders::NewL();
CleanupStack::PushL( mimeHeaders );
mimeHeaders->SetSuggestedFilenameL(fileName3);
// Represents a single attachment and information about the attachment
attaInfo =CMsvAttachment::NewL( CMsvAttachment::EMsvFile );
CleanupStack::PushL( attaInfo );
//Mime Type
_LIT8(KMimeTypeSMIL, "application/smil");
TBufC8<20> mimeType3(KMimeTypeSMIL);
attachId = KMsvNullIndexEntryId;
//Attachment file must be an public folder (e.g. c:\Data\images)
iMmsMtm->CreateAttachment2L(
*store,
attachment,
mimeType3,
*mimeHeaders,
attaInfo,
attachId );
CleanupStack::Pop( attaInfo ); // attaInfo
CleanupStack::PopAndDestroy(mimeHeaders); // mimeHeaders
iMmsMtm->SetMessageRootL(attachId);
attachment.Close();
CleanupStack::PopAndDestroy(); // attachment
store->CommitL();
CleanupStack::PopAndDestroy(); // store
// message must be saved to save the root id
iMmsMtm->SaveMessageL();
}
 
#else //1st and 2nd edition
//Check that the attachment file exists.
if(!ConeUtils::FileExists(attachmentFile))
{
return EFalse;
}
else
{
TBufC8<20> content;
//slide 1
//TEXT
attachmentFile = KDirPictures ;
attachmentFile.Append(KFileName2);
TMsvId attachmentID = KMsvNullIndexEntryId;
iMmsMtm->CreateAttachment2L( attachmentID, attachmentFile );
iMmsMtm->SetAttachmentNameL(attachmentID, _L("Smil.txt"));
content = _L8( "text/plain" );
iMmsMtm->SetAttachmentTypeL( attachmentID, content );
 
//GIF
attachmentFile = KDirPictures;
attachmentFile.Append(KFileName);
attachmentID = KMsvNullIndexEntryId;
iMmsMtm->CreateAttachment2L( attachmentID, attachmentFile );
iMmsMtm->SetAttachmentNameL(attachmentID, _L("flower.gif"));
content = _L8( "image/gif" );
iMmsMtm->SetAttachmentTypeL( attachmentID, content );
 
//slide 2
attachmentFile = KDirPictures;
attachmentFile.Append(KFileName4);
attachmentID = KMsvNullIndexEntryId;
iMmsMtm->CreateAttachment2L( attachmentID, attachmentFile );
iMmsMtm->SetAttachmentNameL(attachmentID, _L("animation1.gif"));
content = _L8( "image/gif" );
iMmsMtm->SetAttachmentTypeL( attachmentID, content );
 
//SMIL
attachmentFile = KDirPictures;
attachmentFile.Append(KFileName3);
attachmentID = KMsvNullIndexEntryId;
iMmsMtm->CreateAttachment2L( attachmentID, attachmentFile );
iMmsMtm->SetAttachmentNameL(attachmentID, _L("tc003.smil"));
content = _L8( "application/smil" );
iMmsMtm->SetAttachmentTypeL( attachmentID, content );
iMmsMtm->SetMessageRootL(attachmentID);
 
}
iMmsMtm->SaveMessageL();
#endif
 
return ETrue;
}

Example Project

http://wiki.forum.nokia.com/index.php/Image:MMSExample.zip

Internal Links

http://wiki.forum.nokia.com/index.php/SMIL

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fHowE5ftoE5fcreateE5faE5fSMIE4cE5fmessageX qdcZpublisherQUxhttpE3aE2fE2fswE2enokiaE2ecomE2fidE2fc764fd1cE2d8b06E2d499aE2d9a6aE2d17c3903d5a65E2fforumE5fnokiaE5fcrawlerE5fagentX qdcZtitleQSxHowE20toE20createE20aE20SMIE4cE20messageE20E2dE20ForumE20NokiaE20WikiX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qrssZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qfnZdistributionQUxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2fX qfnZtopicQUqfnTopicZmessagingQRqmarsZrelevanceQNx100X qfnZtopicQUqfnTopicZmmsQRqdcZtypeQUqrdfsZE52esourceQRqmarsZrelevanceQNx100X qfnZtopicQUqfnTopicZsmilQRqdcZtypeQUqrdfsZE52esourceQRqmarsZrelevanceQNx100X qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qfnZupdatedQDx2008E2d10E2d02X qfnZuserE5ftagQSxmessagingX qfnZuserE5ftagQSxmmsX qfnZuserE5ftagQSxsmilX qmarsZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ