114 MPX_DEBUG(_L("CMPXVideoPlaybackState::HandlePlay()")); |
114 MPX_DEBUG(_L("CMPXVideoPlaybackState::HandlePlay()")); |
115 } |
115 } |
116 |
116 |
117 // ------------------------------------------------------------------------------------------------ |
117 // ------------------------------------------------------------------------------------------------ |
118 // CMPXVideoPlaybackState::HandlePause() |
118 // CMPXVideoPlaybackState::HandlePause() |
119 // |
|
120 // @@FP for now we are assuming that Pause is only valid for Playing state |
|
121 // ------------------------------------------------------------------------------------------------ |
119 // ------------------------------------------------------------------------------------------------ |
122 void CMPXVideoPlaybackState::HandlePause() |
120 void CMPXVideoPlaybackState::HandlePause() |
123 { |
121 { |
124 MPX_DEBUG(_L("CMPXVideoPlaybackState::HandlePause()")); |
122 MPX_DEBUG(_L("CMPXVideoPlaybackState::HandlePause()")); |
125 } |
123 } |
185 // CMPXVideoPlaybackState::HandleBackground() |
183 // CMPXVideoPlaybackState::HandleBackground() |
186 // ------------------------------------------------------------------------------------------------ |
184 // ------------------------------------------------------------------------------------------------ |
187 void CMPXVideoPlaybackState::HandleBackground() |
185 void CMPXVideoPlaybackState::HandleBackground() |
188 { |
186 { |
189 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::HandleBackground()")); |
187 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::HandleBackground()")); |
190 |
|
191 // Just pause the plackback |
|
192 HandlePause(); |
188 HandlePause(); |
193 } |
189 } |
194 |
190 |
195 // ------------------------------------------------------------------------------------------------ |
191 // ------------------------------------------------------------------------------------------------ |
196 // CMPXVideoPlaybackState::HandleOpenComplete() |
192 // CMPXVideoPlaybackState::HandleOpenComplete() |
524 { |
520 { |
525 aMedia->SetTObjectValueL<TInt>( |
521 aMedia->SetTObjectValueL<TInt>( |
526 TMPXAttribute( KMPXMediaVideoDrmProtected ), |
522 TMPXAttribute( KMPXMediaVideoDrmProtected ), |
527 iVideoPlaybackCtlr->iFileDetails->iDrmProtected ); |
523 iVideoPlaybackCtlr->iFileDetails->iDrmProtected ); |
528 } |
524 } |
529 |
525 |
530 // |
526 // |
531 // Description |
527 // Description |
532 // |
528 // |
533 if ( ( attrV & KMPXMediaVideoDescription.iAttributeId ) && |
529 if ( ( attrV & KMPXMediaVideoDescription.iAttributeId ) && |
534 ( iVideoPlaybackCtlr->iFileDetails->iDescription ) ) |
530 ( iVideoPlaybackCtlr->iFileDetails->iDescription ) ) |
535 { |
531 { |
536 aMedia->SetTextValueL( |
532 aMedia->SetTextValueL( |
537 TMPXAttribute( KMPXMediaVideoDescription ), |
533 TMPXAttribute( KMPXMediaVideoDescription ), |
538 *( iVideoPlaybackCtlr->iFileDetails->iDescription ) ); |
534 *( iVideoPlaybackCtlr->iFileDetails->iDescription ) ); |
539 } |
535 } |
540 |
536 |
541 // |
537 // |
542 // Location |
538 // Location |
543 // |
539 // |
544 if ( ( attrV & KMPXMediaVideoLocation.iAttributeId ) && |
540 if ( ( attrV & KMPXMediaVideoLocation.iAttributeId ) && |
545 ( iVideoPlaybackCtlr->iFileDetails->iLocation ) ) |
541 ( iVideoPlaybackCtlr->iFileDetails->iLocation ) ) |
546 { |
542 { |
547 aMedia->SetTextValueL( |
543 aMedia->SetTextValueL( |
548 TMPXAttribute( KMPXMediaVideoLocation ), |
544 TMPXAttribute( KMPXMediaVideoLocation ), |
549 *( iVideoPlaybackCtlr->iFileDetails->iLocation ) ); |
545 *( iVideoPlaybackCtlr->iFileDetails->iLocation ) ); |
550 } |
546 } |
551 |
547 |
552 // |
548 // |
553 // Copyright |
549 // Copyright |
554 // |
550 // |
555 if ( ( attrV & KMPXMediaVideoCopyright.iAttributeId ) && |
551 if ( ( attrV & KMPXMediaVideoCopyright.iAttributeId ) && |
556 ( iVideoPlaybackCtlr->iFileDetails->iCopyright ) ) |
552 ( iVideoPlaybackCtlr->iFileDetails->iCopyright ) ) |
557 { |
553 { |
558 aMedia->SetTextValueL( |
554 aMedia->SetTextValueL( |
559 TMPXAttribute( KMPXMediaVideoCopyright ), |
555 TMPXAttribute( KMPXMediaVideoCopyright ), |
560 *( iVideoPlaybackCtlr->iFileDetails->iCopyright ) ); |
556 *( iVideoPlaybackCtlr->iFileDetails->iCopyright ) ); |
561 } |
557 } |
562 |
558 |
563 // |
559 // |
564 // Language |
560 // Language |
565 // |
561 // |
566 if ( ( attrV & KMPXMediaVideoLanguage.iAttributeId ) && |
562 if ( ( attrV & KMPXMediaVideoLanguage.iAttributeId ) && |
567 ( iVideoPlaybackCtlr->iFileDetails->iLanguage ) ) |
563 ( iVideoPlaybackCtlr->iFileDetails->iLanguage ) ) |
568 { |
564 { |
569 aMedia->SetTextValueL( |
565 aMedia->SetTextValueL( |
570 TMPXAttribute( KMPXMediaVideoLanguage ), |
566 TMPXAttribute( KMPXMediaVideoLanguage ), |
571 *( iVideoPlaybackCtlr->iFileDetails->iLanguage ) ); |
567 *( iVideoPlaybackCtlr->iFileDetails->iLanguage ) ); |
572 } |
568 } |
573 |
569 |
574 // |
570 // |
575 // Keywords |
571 // Keywords |
576 // |
572 // |
577 if ( ( attrV & KMPXMediaVideoKeywords.iAttributeId ) && |
573 if ( ( attrV & KMPXMediaVideoKeywords.iAttributeId ) && |
578 ( iVideoPlaybackCtlr->iFileDetails->iKeywords ) ) |
574 ( iVideoPlaybackCtlr->iFileDetails->iKeywords ) ) |
579 { |
575 { |
580 aMedia->SetTextValueL( |
576 aMedia->SetTextValueL( |
581 TMPXAttribute( KMPXMediaVideoKeywords ), |
577 TMPXAttribute( KMPXMediaVideoKeywords ), |
582 *( iVideoPlaybackCtlr->iFileDetails->iKeywords ) ); |
578 *( iVideoPlaybackCtlr->iFileDetails->iKeywords ) ); |
583 } |
579 } |
584 } |
580 } |
585 |
581 |
586 // ------------------------------------------------------------------------------------------------ |
582 // ------------------------------------------------------------------------------------------------ |
587 // CMPXVideoPlaybackState::SendErrorToViewL |
583 // CMPXVideoPlaybackState::SendErrorToViewL |
588 // ------------------------------------------------------------------------------------------------ |
584 // ------------------------------------------------------------------------------------------------ |
671 // ------------------------------------------------------------------------------------------------ |
667 // ------------------------------------------------------------------------------------------------ |
672 void CMPXVideoPlaybackState::CommandHandleBackground() |
668 void CMPXVideoPlaybackState::CommandHandleBackground() |
673 { |
669 { |
674 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::CommandHandleBackground()")); |
670 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::CommandHandleBackground()")); |
675 |
671 |
|
672 // |
|
673 // Block playback in the following cases: |
|
674 // - App is not in foreground |
|
675 // - Alarm |
|
676 // - Phone call |
|
677 // - Video call |
|
678 // |
676 if ( !iVideoPlaybackCtlr->iAppInForeground || |
679 if ( !iVideoPlaybackCtlr->iAppInForeground || |
677 iVideoPlaybackCtlr->IsAlarm() || |
680 iVideoPlaybackCtlr->IsAlarm() || |
678 iVideoPlaybackCtlr->IsPhoneCall() || |
681 iVideoPlaybackCtlr->IsPhoneCall() || |
679 iVideoPlaybackCtlr->IsVideoCall() ) |
682 iVideoPlaybackCtlr->IsVideoCall() ) |
680 { |
683 { |
977 _L("error = %d"), aError ); |
980 _L("error = %d"), aError ); |
978 |
981 |
979 if ( aError == KErrNone ) |
982 if ( aError == KErrNone ) |
980 { |
983 { |
981 iVideoPlaybackCtlr->iPlaybackMode->HandleOpenComplete(); |
984 iVideoPlaybackCtlr->iPlaybackMode->HandleOpenComplete(); |
982 |
985 |
983 // |
986 // |
984 // call setposition with converted value saved in openfile |
987 // call setposition with converted value saved in openfile |
985 // |
988 // |
986 if ( iVideoPlaybackCtlr->iSavedPosition > 0 ) |
989 if ( iVideoPlaybackCtlr->iSavedPosition > 0 ) |
987 { |
990 { |
988 MPX_DEBUG(_L("CMPXInitialisingState::HandleOpenComplete() iSavedPosition %d"), iVideoPlaybackCtlr->iSavedPosition ); |
991 MPX_DEBUG(_L("CMPXInitialisingState::HandleOpenComplete() iSavedPosition %d"), iVideoPlaybackCtlr->iSavedPosition ); |
989 |
992 |
990 TInt64 pos( iVideoPlaybackCtlr->iSavedPosition ); |
993 TInt64 pos( iVideoPlaybackCtlr->iSavedPosition ); |
991 pos *= KPbMilliMultiplier; |
994 pos *= KPbMilliMultiplier; |
992 |
995 |
993 MPX_TRAPD( err, iVideoPlaybackCtlr->iPlayer->SetPositionL( pos ) ); |
996 MPX_TRAPD( err, iVideoPlaybackCtlr->iPlayer->SetPositionL( pos ) ); |
994 } |
997 } |
995 |
998 |
996 MPX_DEBUG(_L("CMPXInitialisingState::HandleOpenComplete() Sending Prepare()")); |
999 MPX_DEBUG(_L("CMPXInitialisingState::HandleOpenComplete() Sending Prepare()")); |
997 |
1000 |
998 iVideoPlaybackCtlr->iPlayer->Prepare(); |
1001 iVideoPlaybackCtlr->iPlayer->Prepare(); |
999 } |
1002 } |
1000 else |
1003 else |
1773 0, |
1777 0, |
1774 KErrNone ); |
1778 KErrNone ); |
1775 } |
1779 } |
1776 |
1780 |
1777 // ------------------------------------------------------------------------------------------------ |
1781 // ------------------------------------------------------------------------------------------------ |
1778 // CMPXBufferingState::HandleBackground() |
1782 // CMPXBufferingState::HandleBackground() |
1779 // ------------------------------------------------------------------------------------------------ |
1783 // ------------------------------------------------------------------------------------------------ |
1780 void CMPXBufferingState::HandleBackground() |
1784 void CMPXBufferingState::HandleBackground() |
1781 { |
1785 { |
1782 MPX_DEBUG(_L("CMPXBufferingState::HandleBackground()")); |
1786 MPX_DEBUG(_L("CMPXBufferingState::HandleBackground()")); |
1783 |
|
1784 // we are in buffering state and received a background event |
|
1785 // we cannot pause now but need to pause when buffering is complete |
|
1786 iVideoPlaybackCtlr->iPlaybackMode->HandleBackground(); |
1787 iVideoPlaybackCtlr->iPlaybackMode->HandleBackground(); |
1787 } |
1788 } |
1788 |
1789 |
1789 // ------------------------------------------------------------------------------------------------ |
1790 // ------------------------------------------------------------------------------------------------ |
1790 // CMPXBufferingState::HandleForeground() |
1791 // CMPXBufferingState::HandleForeground() |
1791 // ------------------------------------------------------------------------------------------------ |
1792 // ------------------------------------------------------------------------------------------------ |
1792 void CMPXBufferingState::HandleForeground() |
1793 void CMPXBufferingState::HandleForeground() |
1793 { |
1794 { |
1794 MPX_DEBUG(_L("CMPXBufferingState::HandleForeground()")); |
1795 MPX_DEBUG(_L("CMPXBufferingState::HandleForeground()")); |
1795 |
1796 |
1796 // we are in buffering state and received a background event |
1797 // |
1797 // we cannot pause now but need to pause when buffering is complete |
1798 // We are in buffering state and received a background and foreground event |
|
1799 // playback will continue when buffering is complete |
|
1800 // |
1798 } |
1801 } |
1799 |
1802 |
1800 // ------------------------------------------------------------------------------------------------ |
1803 // ------------------------------------------------------------------------------------------------ |
1801 // CMPXBufferingState::HandlePause() |
1804 // CMPXBufferingState::HandlePause() |
1802 // ------------------------------------------------------------------------------------------------ |
1805 // ------------------------------------------------------------------------------------------------ |
1886 // ------------------------------------------------------------------------------------------------ |
1889 // ------------------------------------------------------------------------------------------------ |
1887 // CMPXSeekingState::HandleBackground() |
1890 // CMPXSeekingState::HandleBackground() |
1888 // ------------------------------------------------------------------------------------------------ |
1891 // ------------------------------------------------------------------------------------------------ |
1889 void CMPXSeekingState::HandleBackground() |
1892 void CMPXSeekingState::HandleBackground() |
1890 { |
1893 { |
1891 MPX_DEBUG(_L("CMPXSeekingState::HandleBackground()")); |
1894 MPX_ENTER_EXIT(_L("CMPXSeekingState::HandleBackground()")); |
|
1895 |
1892 MPX_TRAPD( err, HandleStopSeekL() ); |
1896 MPX_TRAPD( err, HandleStopSeekL() ); |
1893 iVideoPlaybackCtlr->iPlaybackMode->HandleBackground(); |
1897 iVideoPlaybackCtlr->iPlaybackMode->HandleBackground(); |
1894 } |
1898 } |
1895 |
1899 |
1896 // ------------------------------------------------------------------------------------------------ |
1900 // ------------------------------------------------------------------------------------------------ |
1897 // CMPXSeekingState::HandlePause() |
1901 // CMPXSeekingState::HandlePause() |
1898 // ------------------------------------------------------------------------------------------------ |
1902 // ------------------------------------------------------------------------------------------------ |
1899 void CMPXSeekingState::HandlePause() |
1903 void CMPXSeekingState::HandlePause() |
1900 { |
1904 { |
1901 MPX_DEBUG(_L("CMPXSeekingState::HandlePause()")); |
1905 MPX_ENTER_EXIT(_L("CMPXSeekingState::HandlePause()")); |
|
1906 |
1902 MPX_TRAPD( err, HandleStopSeekL() ); |
1907 MPX_TRAPD( err, HandleStopSeekL() ); |
1903 iVideoPlaybackCtlr->iPlaybackMode->HandlePause(); |
1908 iVideoPlaybackCtlr->iPlaybackMode->HandlePause(); |
1904 } |
1909 } |
1905 |
1910 |
1906 // ------------------------------------------------------------------------------------------------ |
1911 // ------------------------------------------------------------------------------------------------ |