<html><head></head><body><div>Le Thursday 21 May 2015 à 06:42 -0700, modelvincent a écrit :</div><blockquote type="cite"><div><br></div></blockquote><blockquote type="cite"><div>However, Now I have a problem with the seek, If I want to seek from master</div><div>or from slave side, the player were I asked to seek go to the good position,</div><div>but the second stay at the same place, and morever they start both to read</div><div>at full speed, without synchronization or anything.</div><div><br></div><div>If I pause my 2 player, they are Pausing correctly, and If I Play on the</div><div>player where I've done the seek, he go back to a normal speed, but not the</div><div>second one who continue to play at full speed...</div><div><br></div><div>I don't understand the problem... :(</div><div></div></blockquote><div><br></div><div>This is where Aurena get complicated. First, I am very unsure if your model of a master/slave player can actually work. When I implemented that in Aurena, I made my life simpler by only having synchronized player (so I don't need to cope with two use cases).</div><div><br></div><div>On the server side, a seek is sent to the clients as "base-time" and "position". The position is the position from the start of the media, while base-time is from the following formula:</div><div><br></div><div> base_time = time_now - position + SEEK_DELAY</div><div><br></div><div>time_now is read from the network clock of course. The SEEK_DELAY is needed, as otherwise at the end of their preroll, all player would already be late and then play full speed. More advanced solution to that, would be to operate the seek in paused state on all clients and add a indication from client to server indicating when the preroll has finished. But Aurena is taking a simplier route here.</div><div><br></div><div>On client side, upon reception of a seek, Aurena will save the new position and base time. It will then do an accurate seek to the position, and update the GStreamer base_time taking into account the seek.</div><div><br></div><div> gst_element_set_base_time (pipeline, base_time + position);</div><div><br></div><div>This entirely depends on the precision of the seek. Again, this is a shortcut, an ideal solution would wait for the seek to complete, re-read the position at that moment and offset taking into account the error.</div><div><br></div><div>For the play pause case. The server does not pass anything special on the play message. Though, on the pause message, the server will pass a "position". This indicate the player where they should be at when they are actually paused. Again, Aurena take a small short cut, instead of letting the stream play until that point, it will simply pause the pipeline, and seek to the pause position (saving that position). When play message is received, it will update the base_time like in the seek, and set the state to playing.</div><div><br></div><div>There is one more case you might not have covered yet. When a player join a synchronization party, it's likely that you want this player to also seek to the current position. This allow quick synchronization of new player. Position is computed by client this way:</div><div><br></div><div> position = now - base_time</div><div><br></div><div>The code source can be found at: git//github.com/thaytan/aurena.git. Hope this was useful.</div><div><br></div><div>Nicolas</div></body></html>