Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayerNative.js |
— | — | @@ -370,10 +370,14 @@ |
371 | 371 | return this.playerElement.currentTime; |
372 | 372 | }, |
373 | 373 | |
374 | | - // Update the poster src ( updates the native object if in dom ) |
| 374 | + /** |
| 375 | + * Updates the poster source for the video tatg |
| 376 | + * @param {string} |
| 377 | + * src Url of the poster iamge |
| 378 | + */ |
375 | 379 | updatePosterSrc: function( src ){ |
376 | 380 | if( this.getPlayerElement() ){ |
377 | | - this.getPlayerElement().poster = src; |
| 381 | + $( this.getPlayerElement() ).attr( 'poster', src ); |
378 | 382 | } |
379 | 383 | // Also update the embedPlayer poster |
380 | 384 | this.parent_updatePosterSrc( src ); |
— | — | @@ -565,8 +569,9 @@ |
566 | 570 | } else { |
567 | 571 | // Should not happen offten |
568 | 572 | this.playerElement.load(); |
569 | | - if( callback) |
| 573 | + if( callback ){ |
570 | 574 | callback(); |
| 575 | + } |
571 | 576 | } |
572 | 577 | }, |
573 | 578 | |
— | — | @@ -586,19 +591,20 @@ |
587 | 592 | * Local method for seeking event |
588 | 593 | * fired when "seeking" |
589 | 594 | */ |
590 | | - onseeking: function() { |
591 | | - mw.log( "native:onSeeking"); |
| 595 | + _onseeking: function() { |
| 596 | + mw.log( "EmbedPlayerNative::onSeeking " + this.seeking); |
592 | 597 | // Trigger the html5 seeking event |
593 | 598 | //( if not already set from interface ) |
594 | 599 | if( !this.seeking ) { |
595 | 600 | this.seeking = true; |
596 | | - |
597 | 601 | // Run the onSeeking interface update |
598 | 602 | this.controlBuilder.onSeek(); |
599 | 603 | |
600 | 604 | // Trigger the html5 "seeking" trigger |
601 | | - mw.log("native:seeking:trigger:: " + this.seeking); |
602 | | - $( this ).trigger( 'seeking' ); |
| 605 | + mw.log("EmbedPlayerNative::seeking:trigger:: " + this.seeking); |
| 606 | + if( this._propagateEvents ){ |
| 607 | + $( this ).trigger( 'seeking' ); |
| 608 | + } |
603 | 609 | } |
604 | 610 | }, |
605 | 611 | |
— | — | @@ -606,20 +612,25 @@ |
607 | 613 | * Local method for seeked event |
608 | 614 | * fired when done seeking |
609 | 615 | */ |
610 | | - onseeked: function() { |
611 | | - mw.log("native:onSeeked"); |
| 616 | + _onseeked: function() { |
| 617 | + mw.log("EmbedPlayerNative::onSeeked " + this.seeking + ' ct:' + this.playerElement.currentTime ); |
| 618 | + // sync the seek checks so that we don't re-issue the seek request |
| 619 | + this.previousTime = this.currentTime = this.playerElement.currentTime; |
612 | 620 | // Trigger the html5 action on the parent |
613 | 621 | if( this.seeking ){ |
614 | 622 | this.seeking = false; |
615 | | - $( this ).trigger( 'seeked' ); |
| 623 | + if( this._propagateEvents ){ |
| 624 | + $( this ).trigger( 'seeked' ); |
| 625 | + } |
616 | 626 | } |
617 | | - this.seeking = false; |
| 627 | + // update the playhead status |
| 628 | + this.monitor(); |
618 | 629 | }, |
619 | 630 | |
620 | 631 | /** |
621 | 632 | * Handle the native paused event |
622 | 633 | */ |
623 | | - onpause: function(){ |
| 634 | + _onpause: function(){ |
624 | 635 | mw.log( "EmbedPlayer:native: OnPaused:: " + this._propagateEvents ); |
625 | 636 | if( this._propagateEvents ){ |
626 | 637 | this.parent_pause(); |
— | — | @@ -629,7 +640,7 @@ |
630 | 641 | /** |
631 | 642 | * Handle the native play event |
632 | 643 | */ |
633 | | - onplay: function(){ |
| 644 | + _onplay: function(){ |
634 | 645 | mw.log("EmbedPlayer:native:: OnPlay::" + this._propagateEvents ); |
635 | 646 | // Update the interface ( if paused ) |
636 | 647 | if( this._propagateEvents ){ |
— | — | @@ -644,10 +655,10 @@ |
645 | 656 | * Used to update the media duration to |
646 | 657 | * accurately reflect the src duration |
647 | 658 | */ |
648 | | - onloadedmetadata: function() { |
| 659 | + _onloadedmetadata: function() { |
649 | 660 | this.getPlayerElement(); |
650 | 661 | if ( this.playerElement && ! isNaN( this.playerElement.duration ) ) { |
651 | | - mw.log( 'f:onloadedmetadata metadata ready Update duration:' + this.playerElement.duration + ' old dur: ' + this.getDuration() ); |
| 662 | + mw.log( 'EmbedPlayerNative :onloadedmetadata metadata ready Update duration:' + this.playerElement.duration + ' old dur: ' + this.getDuration() ); |
652 | 663 | this.duration = this.playerElement.duration; |
653 | 664 | } |
654 | 665 | |
— | — | @@ -672,7 +683,7 @@ |
673 | 684 | * Note: this way of updating buffer was only supported in Firefox 3.x and |
674 | 685 | * not supported in Firefox 4.x |
675 | 686 | */ |
676 | | - onprogress: function( event ) { |
| 687 | + _onprogress: function( event ) { |
677 | 688 | var e = event.originalEvent; |
678 | 689 | if( e && e.loaded && e.total ) { |
679 | 690 | this.bufferedPercent = e.loaded / e.total; |
— | — | @@ -681,16 +692,15 @@ |
682 | 693 | }, |
683 | 694 | |
684 | 695 | /** |
685 | | - * Local method for progress event |
686 | | - * fired as the video is downloaded / buffered |
687 | | - * |
688 | | - * Used to update the bufferedPercent |
| 696 | + * Local method for end of media event |
689 | 697 | */ |
690 | | - onended: function() { |
| 698 | + _onended: function() { |
691 | 699 | var _this = this; |
692 | | - mw.log( 'EmbedPlayer:native: onended:' + this.playerElement.currentTime + ' real dur:' + this.getDuration() + ' ended ' + this._propagateEvents ); |
693 | | - if( this._propagateEvents ){ |
694 | | - this.onClipDone(); |
| 700 | + if( this.getPlayerElement() ){ |
| 701 | + mw.log( 'EmbedPlayer:native: onended:' + this.playerElement.currentTime + ' real dur:' + this.getDuration() + ' ended ' + this._propagateEvents ); |
| 702 | + if( this._propagateEvents ){ |
| 703 | + this.onClipDone(); |
| 704 | + } |
695 | 705 | } |
696 | 706 | } |
697 | 707 | }; |