Please help me with a problem I have embedding a video in a Treesave article. I am trying to embed the video using the "Flowplayer" framework (
http://flowplayer.org/). The problem I have with this is understanding where exactly the DOM of what is shown to the user is located. I tried several ways to embed the video with Flowplayer. The approach that worked best was to initialize the player directly after the html of the player is rendered:
<div class="player" data-swf="flowplayer/flowplayer.swf" data-ratio="0.417">
<video>
<source type="video/mp4" src="/upload/content_field_values/325/624x260_original.mp4"/>
</video>
</div>
<script>
$(".player").flowplayer({debug: true, native_fullscreen: true, tooltip: false, splash: false});
</script>
this works to a certain amount but the movie never plays because when the "ready" event is fired, Flowplayer tries to initialize the movie by the initial reference given to it which was $('player'). But this reference does not anymore contain the reference to the DOM that is actually displayed because any changes made to this DOM are not reflected in what the user sees.
I do not know the inner workings of the Treesaver framework enough to understand what is going on here. However, on another thread I found this recommendation by Andrea Campi:
* also, do not generally assume that content is attached to the document;
* in general, *do not* manipulate the document DOM; instead use the Treesaver objects that you receive from the event handlers.
This might be the key. When I couple the movie initialization with a Treesaver event and operate with the proper DOM reference given from that object. But i do not understand how exactly I can put this recommendation into use. I tried this.
treesaver.addListener(document, 'treesaver.articlechanged', function (event) {
$(event.srcElement).find('.player').flowplayer({debug: true, native_fullscreen: true, tooltip: false, splash: false});
});
but this doesn't work. I wonder if I am on the right trace? Please can you help me with this? I tried the whole day today but without a solution.
Regards,
Mark Kessler