-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set the Timing options of an Audio shape? #619
Labels
enhancement
New feature or request
Comments
Sorry for the answer delay. Such feature is not available yet. We will take a look. |
Given a slidepart, and using DocumentFormat.OpenXml.Presentation;, I used brute force, but I could not determine the audio duration accurately so set it to indefinite: IEnumerable<DocumentFormat.OpenXml.Presentation.Timing> animationTimings = slidePart.Slide.Descendants<DocumentFormat.OpenXml.Presentation.Timing>();
foreach (DocumentFormat.OpenXml.Presentation.Timing animationTiming in animationTimings)
{
animationTiming.Remove();
//^ Remove any pre-existing slide animations
}
var slide = slidePart.Slide;
string timing = @"<p:timing xmlns:p=""http://schemas.openxmlformats.org/presentationml/2006/main""><p:tnLst><p:par><p:cTn id=""1"" dur=""indefinite"" restart=""never"" nodeType=""tmRoot""><p:childTnLst><p:seq concurrent=""1"" nextAc=""seek""><p:cTn id=""2"" dur=""indefinite"" nodeType=""mainSeq""><p:childTnLst><p:par><p:cTn id=""3"" fill=""hold""><p:stCondLst><p:cond delay=""indefinite""/><p:cond evt=""onBegin"" delay=""0""><p:tn val=""2""/></p:cond></p:stCondLst><p:childTnLst><p:par><p:cTn id=""4"" fill=""hold""><p:stCondLst><p:cond delay=""0""/></p:stCondLst><p:childTnLst><p:par><p:cTn id=""5"" presetID=""1"" presetClass=""mediacall"" presetSubtype=""0"" fill=""hold"" nodeType=""withEffect""><p:stCondLst><p:cond delay=""2000""/></p:stCondLst><p:childTnLst><p:cmd type=""call"" cmd=""playFrom(0.0)""><p:cBhvr><p:cTn id=""6"" dur=""indefinite"" fill=""hold""/><p:tgtEl><p:spTgt spid=""4""/></p:tgtEl></p:cBhvr></p:cmd></p:childTnLst></p:cTn></p:par></p:childTnLst></p:cTn></p:par></p:childTnLst></p:cTn></p:par></p:childTnLst></p:cTn><p:prevCondLst><p:cond evt=""onPrev"" delay=""0""><p:tgtEl><p:sldTgt/></p:tgtEl></p:cond></p:prevCondLst><p:nextCondLst><p:cond evt=""onNext"" delay=""0""><p:tgtEl><p:sldTgt/></p:tgtEl></p:cond></p:nextCondLst></p:seq><p:audio><p:cMediaNode vol=""80000""><p:cTn id=""7"" display=""0""><p:stCondLst><p:cond delay=""indefinite""/></p:stCondLst><p:endCondLst><p:cond evt=""onStopAudio"" delay=""0""><p:tgtEl><p:sldTgt/></p:tgtEl></p:cond></p:endCondLst></p:cTn><p:tgtEl><p:spTgt spid=""4""/></p:tgtEl></p:cMediaNode></p:audio></p:childTnLst></p:cTn></p:par></p:tnLst></p:timing>";
//^ For id=""6"", the dur has been set to ""indefinite"", rather than the duration of the audio.
XElement xElt = XElement.Parse(timing, LoadOptions.PreserveWhitespace);
var newChild = new DocumentFormat.OpenXml.Presentation.Timing(timing);
slide.AddChild(newChild); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ShapeCrawler makes it easy to add an Audio shape to a slide!
Any suggestions on how to set the timing options of that new audio shape would be greatly appreciated, such as:
(a) Start set to 'With Previous'
(b) Delay set to 2 seconds
The text was updated successfully, but these errors were encountered: