PHPOffice / PHPPresentation

A pure PHP library for reading and writing presentations documents
https://phpoffice.github.io/PHPPresentation
Other
1.31k stars 521 forks source link

Audio and Video in Office 2010 is working in this version of PHPPresentation (repo available). #491

Open Laar2 opened 6 years ago

Laar2 commented 6 years ago

Update :

code available in this repo: https://github.com/Laar2/PHPPresentation

I am using PHPPresentation to create PPTX for Office 2010. When adding a video the PPTX must be repaired. I compared some files and saw the following :

(the used IDs are only for clarifying ...)

So when the missing image is there, the references to the media are all ok and the controles are linked (shape-target) to the right ID, then it works OK in Office 2010.

Is there someone still working on PHPpresentation?

Sample_03_Image_manually_repaired.pptx Sample_03_Image_needs_repair.pptx

all_files.zip

Laar2 commented 6 years ago

It is working :-)

I made several adjustments in the code and now i am able to add a video to the PPTX, without Powerpoint complaining about repairs.....

I reversed engineered the "Timing"- block in the Slide. I also extended a Video-class from Media, just because I want to add audio to the PPTX using an Audio Class. Which is working also.

Some fine-tuning is still needed.....

Cryde commented 5 years ago

Hello,

I'm facing an issue with video insertion (that need to be repair)

How did you solve this ? Is a patch available somewhere ?

Thank you

Laar2 commented 5 years ago

I created my own version of PHPpresentation. The code includes samples how to use the new classes Audio en Video. But ONLY for PPTX, not for ODP!

I can send you the code. Because of the size of the audio- and video-files (50 MB) used in the samples, it is too large to attach here. Or I can make smaller audio and video files, but I don't have the time now.....

Cryde commented 5 years ago

@Laar2 if you can, just send me the code, I will see on my own how to use it Of course if it's possible for you

Thank you in advance

Laar2 commented 5 years ago

@Cryde You can download the code here :

https://github.com/Laar2/PHPPresentation

See the samples : Sample_21_audio.php Sample_22_media.phpo Sample_23_video.php PHPPresentation/src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php

(I renamed the samples, so they popup on the sample-page in the '2x'-menu.)

gregsullivan commented 5 years ago

@Laar2 Thanks for this—I'd begun noticing the same issues while manually comparing output for slides with video from PowerPoint with similar output from PHPPresentation, and found your fork just as I'd started doing the work of trying to resolve those mismatches myself.

Much appreciated! You say fine-tuning is needed; have you encountered any issues with PowerPoint compatibility so far?

Laar2 commented 5 years ago

@gregsullivan I am using this version on one of my websites without any problems. I use:

I did not test or try other versions of Powerpoint.

BTW. I cleaned my repository (was 70 different files). I put the original files back where possible, so only 15 different files now. When you compare my repo to the original you can see the differences more easily.

gregsullivan commented 5 years ago

@Laar2 Thanks for letting me know, and thanks for making those changes!

To the extent it's useful for anyone else to know, this solved the problem for me on the latest Office 365 version of PowerPoint. Previously any presentations with videos would require repair, which removed the video.

ashishnishad commented 4 years ago

@Laar2 First of all thank you very much for providing audio support in ppt. But i have a query regarding auto play slides music in background so there is any method or function using it ppt slideshow automatically play music because currently i need to play it manually. I want added audio automatically play when i start slideshow. Thanks

Laar2 commented 4 years ago

@ashishnishad I just had a quick look at it.

Quick Workaround is maybe;

I'll try to find/build in this option in this version of PHPPresentation

ashishnishad commented 4 years ago

@Laar2 I have an issue with .wav extension audio, in PowerPoint showing codec unavailable.

Laar2 commented 4 years ago

@ashishnishad Google is showing lots of solutions for that. Have you tried mp3?

ashishnishad commented 4 years ago

@Laar2 Yeah, mp3 is working fine but i am recording voice from my website and then using in ppt and recorded audio in .wav format

Laar2 commented 4 years ago

@ashishnishad I don't think the problem is in PHPPresentation. Maybe your recorded WAV does not have the right format/codec? Maybe the codec you use on your website isn't present on the computer you play the wav (in PPTX) ??

Did you unzip the PPTX and tried to play the wav directly on your machine?

ashishnishad commented 4 years ago

@Laar2 Yes audio is playing fine in browser.

ashishnishad commented 4 years ago

@Laar2 Have you any idea about why exported ppt is not working in ppt 2007 version ?