interlegis / interlegis.portalmodelo.policy

Componente de políticas do Portal Modelo
0 stars 1 forks source link

Replace collective.flowplayer with wildcard.media. #3

Open ramiroluz opened 4 years ago

ramiroluz commented 4 years ago

It makes it impossible to run the buildout without removing this component.

There is a substitute, wildcard.media. I am replacing the occurrences of collective.flowplayer with wildcard.media.

ramiroluz commented 4 years ago

Here I need help to show media audio/video player like the two on the right column:

http://pm3demo.interlegis.leg.br/

Captura de tela de 2020-05-15 10-17-42

https://github.com/interlegis/interlegis.portalmodelo.policy/blob/6a430a21f84226fa0df2cba4ae77324f2735dd08/src/interlegis/portalmodelo/policy/profiles/default/portlets.xml#L83

ramiroluz commented 4 years ago

Here it is where some audio and video files are created with the flowplayer layout.

https://github.com/interlegis/interlegis.portalmodelo.policy/blob/6a430a21f84226fa0df2cba4ae77324f2735dd08/src/interlegis/portalmodelo/policy/config.py#L631

Here is the expected result (if you have flashplayer): http://pm3demo.interlegis.leg.br/institucional/audios

ramiroluz commented 4 years ago

This search, on May 15th, returned the occurrences of collective flowplayer no the code. https://github.com/interlegis/interlegis.portalmodelo.policy/search?q=flowplayer&unscoped_q=flowplayer

And this one, for the keywork Player (a portlet). https://github.com/interlegis/interlegis.portalmodelo.policy/search?q=Player

ramiroluz commented 4 years ago

It is not missing anymore, but it is very outdated, will just change the title.

The missing package, used by collective.flowplayer, is hachoir-parser:

We have no distributions for hachoir-parser that satisfies 'hachoir-parser==1.3.4'.
Couldn't find index page for 'hachoir-parser' (maybe misspelled?)
ramiroluz commented 4 years ago

Found this: https://github.com/RedTurtle/redturtle.video/blob/16b191953051aee3f4438afd8ac2b38d01aebea1/README.rst

ramiroluz commented 4 years ago

And this: https://github.com/RedTurtle/redturtle.video/blob/16b191953051aee3f4438afd8ac2b38d01aebea1/redturtle/video/to_wildcardmedia/migrator.py

ramiroluz commented 4 years ago

This can be useful for audio or video views: https://github.com/RedTurtle/wildcardmedia.vimeo/blob/9b1f45e464fc1531d57232d4dcd2227cf92bf14a/src/wildcardmedia/vimeo/browser/videoembedcode.py

The template: https://github.com/RedTurtle/wildcardmedia.vimeo/blob/9b1f45e464fc1531d57232d4dcd2227cf92bf14a/src/wildcardmedia/vimeo/browser/templates/vimeoembedcode_template.pt

cekk commented 4 years ago

Hi @ramiroluz , what's exactly your problem? We're using wildcard.media since years and dropped out redturtle.video/flowplayer because they are outdated

ramiroluz commented 4 years ago

Hi @cekk. Thanks for the help.

Default file view (player)

This product was using flowplayer as the default view for audio and video: https://github.com/interlegis/interlegis.portalmodelo.policy/blob/master/src/interlegis/portalmodelo/policy/config.py#L631

Need to do the same with wildcard.media.

Audio and Video behaviour

Here the mp3 files are given the IAudio behavior: https://github.com/interlegis/interlegis.portalmodelo.policy/blob/6a430a21f84226fa0df2cba4ae77324f2735dd08/src/interlegis/portalmodelo/policy/setuphandlers.py#L275

Need to do the same with IAudioEnabled I presume.

Portlet:

This product have an audio player portlet: https://github.com/interlegis/interlegis.portalmodelo.policy/blob/6a430a21f84226fa0df2cba4ae77324f2735dd08/src/interlegis/portalmodelo/policy/profiles/default/portlets.xml#L84

Need a similar feature using wildcard.media.

Could you help me find docs or samples on how to do it?

ramiroluz commented 4 years ago

In the file config.py is set a structure that is used on the setup handlers to create the items. The command used is api.content.create:

https://github.com/interlegis/interlegis.portalmodelo.policy/blob/master/src/interlegis/portalmodelo/policy/setuphandlers.py#L106

ramiroluz commented 4 years ago

@cekk by the way, creating the audio via web is working well after replacing collective.flowplayer by wildcard.media, so I need to do it via scripts and configuration, thats what I don't know.

ramiroluz commented 4 years ago

@cekk at this point, the audio and video files are being created, but the web component is not playing the audio/video content. It is possible to download the files. Audio and video files created via script or web are behaving the same way, so it is probably a configuration or javascript problem.

ramiroluz commented 4 years ago

The errors on the webdeveloper console are:


Source map error: request failed with status 404
Resource URL: http://localhost:8080/portal/portal_javascripts/Sunburst%20Theme/++resource++wildcard-media/integration-p4.js
Source Map URL: underscore-min.map;
2
O carregamento HTTP falhou com o status 500. Falha no carregamento da mídia http://localhost:8080/portal/institucional/audios/campanha-l…mp3/@@view/++widget++form.widgets.IAudio.audio_file/@@stream. campanha-legbr.mp3
NotSupportedError: The media resource indicated by the src attribute or assigned media provider object was not suitable.

​```
ramiroluz commented 4 years ago

The traceback on the zope log:

http://localhost:8080/portal/institucional/audios/campanha-legbr.mp3/@@view/++widget++form.widgets.IAudio.audio_file/@@stream
Traceback (innermost last):
  Module ZPublisher.Publish, line 141, in publish
  Module ZServer.HTTPResponse, line 261, in setBody
AssertionError
ramiroluz commented 4 years ago

This assertion error is caused by a empty header.

-> assert(self.headers.has_key('content-length'))
(Pdb) self.headers.has_key('content-length')
False
(Pdb) n
AssertionError: AssertionError()
ramiroluz commented 4 years ago

This link may be useful to create the portlet: https://community.plone.org/t/integrate-wildcard-media-with-tinymce-in-plone-5-2/8769/2

This may be useful to create an upgrade step: https://community.plone.org/t/small-project-migration-with-customized-barceloneta/11315

This one have some references on how to configure a behavior, don't know if we need this, saving just in case: https://community.plone.org/t/override-a-schema-provided-by-a-behavior/8347/6

This is a topic created to help keep track of the solution: https://community.plone.org/t/replacing-collective-flowplayer-with-wildcard-media/12358

fredvd commented 4 years ago

@ramiroluz It could be that your player is not functioning because it requires ranges support from the server. At least the Apple ecosystem will not play video's because it tries to request a range to test for compatibility. See thiis forum posts with links to pull requests.

https://community.plone.org/t/partial-streaming-of-videos-is-back/12331

These fixes have not yet landed in an official Plone release.

ramiroluz commented 4 years ago

Thanks, I am reading.

But, in this case, it is an issue of wildcard.media? Or Plone/Zope itself?

fredvd commented 4 years ago

It is/was an issue in PloneZope itself, where the URL on which the (media) file is served does not support http headers for partial streaming.

AFAICS wildcard.media worked around this issue by adding an implementation or exposing a partly for this using a widget in https://github.com/collective/wildcard.media/blob/master/wildcard/media/browser/widget.py , allthough much of the controls for length etc have now been aded to plone.namedfile and were not in wildcard.media.

So I might be wrong about what the widget actually did/does in wildcard.media

ramiroluz commented 4 years ago

@fredvd, now I see. There are two pending pull requests that may solve this issue.

This one in wildcard.media, which the building is failing, I think I know why. https://github.com/collective/wildcard.media/pull/69

And this one in plone.namedfile, created by you: https://github.com/plone/plone.namedfile/pull/94

I am trying to mix these two in a product, doing it with a hammer. :smile:

I had cloned the repos and overwritten the eggs src folder with a cp -r.

Expecting to test if it solves my special case.

fredvd commented 4 years ago

I have 'streaming' now working in Plone 5.1 with just the default File contenttype and an overwritten view where I add a javascript mediaplayer/poly, but that javascript isn't even necessary.

https://github.com/plone/plone.namedfile/pull/94 is my backport for Plone 5.1 , the original patch/pull request was created by @mamico on plone.namedfile master hand has already been merged: https://github.com/plone/plone.namedfile/pull/86

Please note that there is a separate pull request on plone.app.caching because some headers need to be removed/invalidated for Ranges, but it's not necessary for the streaming to work.

ramiroluz commented 4 years ago

Good, will try this merged version also. Just need the range stuff right now (no need for the svg support).

ramiroluz commented 4 years ago

I was trying to test the pull requests against the product I am working on (interlegis.portalmodelo.policy), but it get complicated. I am thinking that my best shot is to wait for the next 4.3 release.

ramiroluz commented 4 years ago

@fredvd What I could do to try to backport this to plone4.3, like how I change things the way you did and run the tests against 4.3?

Maybe a Plone 4.3 with the patched wildcard.media and plone.namedfile? What would be the easier way to do this?

fredvd commented 4 years ago

@fredvd What I could do to try to backport this to plone4.3, like how I change things the way you did and run the tests against 4.3?

Sorry, lost focus on this thread. I'm not sure if any of the 'fancy' low level stuff around ZODB en blobs which these patches depend on are already present in Plone 4 in this way......

mamico commented 4 years ago

@fredvd What I could do to try to backport this to plone4.3, like how I change things the way you did and run the tests against 4.3?

Maybe a Plone 4.3 with the patched wildcard.media and plone.namedfile? What would be the easier way to do this?

@ramiroluz If I remember well in Plone 4.3 you have p.a.blob, so no needs to have updated plone.namedfile. Do you have the issue with wildcard.media and Plone 4.3 ? Have you tried with a wildcard.media version before the python3 porting (eg 2.0.4) ?

ramiroluz commented 4 years ago

@mamico I tried, but was sometime ago, and now I am focused on another task, but as far as I remember, the problem was the same.

I didn't tried to create the media files as blobs in the initial script.

The thing is that the wildcard.media uses p.namedfile itself. Which is pinned in the plone-versions.cfg and I don't like to unpin such packages.

For now, I will have to focus on other task, after that I might try more things based on your comments.

Thanks @fredvd and @mamico.