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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 1322-v2 #6346

Closed
wants to merge 0 commits into from
Closed

Feature 1322-v2 #6346

wants to merge 0 commits into from

Conversation

kntndrsn
Copy link
Contributor

Description

Second iteration of #1322 using the embedded player and creating the image from the player.

Related issues

#1322

Has this been tested?

  • 馃憤 yes, I added tests to the test suite
  • 馃挱 no, because this PR is a draft and still needs work
  • 馃檯 no, because this PR does not update server code
  • 馃檵 no, because I need help

Screenshots

Advanced Settings section has been updated with a "Select from video" option.

image

When the user selects "Select from frame", the embedded player is loaded.

image

The user can play through the video to select an image.

image

When the user selects "Use frame" the preview is updated.

image

When the user clicks the normal "Update" button, the update is applied.

image

@kntndrsn
Copy link
Contributor Author

@Chocobozzz Hi. I tried using the my-embed component instead of making my own iframe but I'm having some challenges getting the embed api to work with it. I added a parameter allowing the API to be enabled, but it seems that the dynamically inserted iframe isn't accessible. I've tried what I can find online including ngAfterViewInit to setup the embed-api, but no luck. Any suggestions?

@kntndrsn
Copy link
Contributor Author

@Chocobozzz Hello. Please lmk if there is anything else I can do on this one.

@kntndrsn kntndrsn changed the title feat-1322-v2-initial-commit Feature 1322-v2 May 13, 2024
Copy link
Owner

@Chocobozzz Chocobozzz left a comment

Choose a reason for hiding this comment

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

Thanks a lot and sorry for the late review!


</div>

<div id="embedContainer" class="" style="position: relative;"></div>
Copy link
Owner

Choose a reason for hiding this comment

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

You can use and improve our embed component instead of injecting your embed code? https://github.com/Chocobozzz/PeerTube/blob/develop/client/src/app/shared/shared-main/video/embed.component.ts

Copy link
Contributor Author

@kntndrsn kntndrsn May 28, 2024

Choose a reason for hiding this comment

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

I made a comment above about this. I made an honest effort to make the my-embed component work, however, I couldn't get the Embed API to work with it. I did search the code for other places it was used but couldn't find anything that would help me. If there is something I have missed or if you have some thoughts on how to approach, I can try again.

<div id="embedContainer" class="" style="position: relative;"></div>

<div class="inputs">
<my-reactive-file *ngIf="!selectingFromVideo" inputName="uploadNewThumbnail" inputLabel="Upload image"
Copy link
Owner

Choose a reason for hiding this comment

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

Can you try to use @if/@else to it's clearer to read? https://blog.angular-university.io/angular-if/


canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height)

return canvas.toDataURL('image/jpeg')
Copy link
Owner

Choose a reason for hiding this comment

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

Do you think we can generate a blob directly so we don't have to change server code? https://stackoverflow.com/questions/6850276/how-to-convert-dataurl-to-file-object-in-javascript

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can create as a blob, but I'm unable to figure out how to attach it such that the server code will detect it as an attached file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was able to get this one figured out. Just had to create a File object with the proper MIME type to set as the form value.

@Chocobozzz
Copy link
Owner

@kntndrsn Do you need help to update the PR?

@kntndrsn
Copy link
Contributor Author

@kntndrsn Do you need help to update the PR?

I actually didn't mean to close. I had to rebase my repo to get back to the current position and it must have decided to close it. I did initially try the two points you mentioned

  1. Use my-embed component (see comment above)
  2. Create as blob to attach so we can avoid changing server code.

Neither worked for me, but was going to give it another go when I found some time.

@Chocobozzz
Copy link
Owner

Please create another PR I can try so I can update your code to include my suggestions :)

@kntndrsn
Copy link
Contributor Author

Please create another PR I can try so I can update your code to include my suggestions :)

#6424

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

2 participants