Skip to content
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

Support Videos #257

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Muhammad-Altabba
Copy link

  • Tested with .mp4 on Chrome

  • Done on fast. So there could be things like :
    - Duplication on CSS classes usage
    - Some scenarios may have not been handled
    - Many enhancements could be done

  • Related to Enhancement: (add videos in the gallery) #149

 - Tested with .mp4 on Chrome
 - Done on fast. So there could be things like :
         - Duplication on CSS classes usage
         - Some scenarios may have not been handled
         - Many enhancments could be done
this.loading = false;
this.startAutoPlay();
this.changeDetectorRef.markForCheck();
} else if (this.type == 'video') {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that videos could require something different than what is inside the above block. I kept this condition, with an empty block, it to highlight that.

So, this condition else if (this.type == 'video') should either be removed along with its empty block. Or, the condition || this.type == 'video' should be removed and the empty block should be filled of what is required.

@Muhammad-Altabba
Copy link
Author

I created a fast NPM package at https://www.npmjs.com/package/ngx-image-video-gallery to be used in the mean time.
However, because I did not want to really create a new package I did not do a full renaming. So, to use ngx-image-video-gallery, you have so import from it like this: import { NgxGalleryImage } from 'ngx-image-video-gallery/dist/bundles/ngx-gallery.umd.js'
I will not maintain that package. And I will most likely delete it once this pull request is approved.

@@ -268,9 +268,14 @@ export class NgxGalleryComponent implements OnInit, DoCheck, AfterViewInit {
}

private setImages(): void {
const _this:NgxGalleryComponent = this;
Copy link

@geofmigliacci geofmigliacci Jun 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be avoided with fat arrow function (if it doesn't have to be compatible with angular aot compilation)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are write. I replaced it with arrow function.

return fileSource.substr(5, Math.min(fileSource.indexOf(';'), fileSource.indexOf('/')) - 5);
}
let fileExtension = fileSource.split('.').pop().toLowerCase();
if (!fileExtension
Copy link

@geofmigliacci geofmigliacci Jun 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe using a indexOf with an array of file type could be better?
Moreover, using mime type could be a better solution (look for mime/type supported by current browsers) & I don't think that using substr is useful there.

fileSource.indexOf("video/mp4") as example is enough if fileSource is a dataUrl.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes indexOf is better for most of the cases. But substr I think that here it will make this piece of code compatible with any content type. If this component will support other types later. This line can stay the as-is.
However, there was unnecessary usage of substr inside the next else if. I deleted it in the second commit.

<div class="ngx-gallery-icons-wrapper">
<ngx-gallery-action *ngFor="let action of actions" [icon]="action.icon" [disabled]="action.disabled" [titleText]="action.titleText" (onClick)="action.onClick($event, image.index)"></ngx-gallery-action>
<div *ngFor="let image of getImages(); let i = index;">
<div *ngIf="image.type == 'image'" class="ngx-gallery-image" [ngClass]="{ 'ngx-gallery-active': selectedIndex == image.index, 'ngx-gallery-inactive-left': selectedIndex > image.index, 'ngx-gallery-inactive-right': selectedIndex < image.index, 'ngx-gallery-clickable': clickable }"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use === instead of ==, maybe using a else with a ng-template is better ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the code to have ===.
However, I do not like the Angular style of if else especially when there is if, else-if and else.

@Muhammad-Altabba
Copy link
Author

Hello @myerffoeg,
Do you mind accepting this pull request? And you can after that modify what need enhancements?
Best regards,

@Muhammad-Altabba
Copy link
Author

Hi @myerffoeg,
Kindly accept the changes if there are no issues. Or else some developers may start forking my fork like https://github.com/alvarovazquezrodriguez/ngx-gallery

@codemx
Copy link

codemx commented Aug 3, 2019

@myerffoeg are you considering merging @Muhammad-Altabba 's updates to the library ? please consider his request

@yashwp
Copy link

yashwp commented Aug 12, 2019

@myerffoeg Please merge this PR and also, update the package for Angular 8 support.

@geofmigliacci
Copy link

geofmigliacci commented Aug 16, 2019

@codemx @yashwp @Muhammad-Altabba I do not have the write access right to do that, I have just done a code review to accelerate the process for the repository author.

If you want to accelerate the process you can : review the code, suggest improvements or contact the author @lukasz-galka .

@Muhammad-Altabba
Copy link
Author

Thanks @myerffoeg,

Hello @lukasz-galka,
Do you mind merging this pull request?

@Muhammad-Altabba
Copy link
Author

Hello @lukasz-galka

@codemx
Copy link

codemx commented Sep 8, 2019

Hi @lukasz-galka , can we kindly proceed with this request?

@lukasz-galka
Copy link
Owner

Hi guys, I will take a look on it on Monday

@codemx
Copy link

codemx commented Sep 29, 2019

Hi @lukasz-galka we are still waiting for this.. can you kindly proceed?

@steveacalabro
Copy link

@lukasz-galka @codemx Any luck on this feature?

@codemx
Copy link

codemx commented Oct 23, 2019

@steveacalabro Not sure why @lukasz-galka is not looked at this as he promised around 6 weeks ago. he is the owner of this and we all are waiting for his action. @Muhammad-Altabba is there any alternatives ?

@dankcellar
Copy link

Is this getting merged anytime soon? @lukasz-galka @steveacalabro

@solcre-gr
Copy link

+1

@kolkov
Copy link

kolkov commented Dec 12, 2019

I will try to implement in my Angular 8++ repo.

@kolkov
Copy link

kolkov commented Dec 12, 2019

@hverma
Copy link

hverma commented Jan 28, 2020

@lukasz-galka will this request be merged soon?

@hverma
Copy link

hverma commented Feb 1, 2020

https://www.npmjs.com/package/@kolkov/ngx-gallery

@kolkov Thx for creating an angular 8 version. Wondering, if you will merge these changes to your repo soon?

@Etmutt
Copy link

Etmutt commented Apr 26, 2020

definetly that would be a very nice addition

@kolkov
Copy link

kolkov commented Apr 26, 2020

This merged. Try latest version please.

@marcioveiga16
Copy link

marcioveiga16 commented Oct 22, 2020

This should be merged, i'm already using, but i believe i found a bug, if i have more than one video when i click to change to the next one, it changes to the same one, but if i place an image between the videos it works fine.

@Muhammad-Altabba
Copy link
Author

Hello guys,
It is really a long time passed 😄 .
I had the library published on https://www.npmjs.com/package/ngx-image-video-gallery long time ago and there are about 19 weekly downloads 😄 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet