Guest User

Untitled

a guest
Dec 10th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. function isPlayable( obj, tracksBy, index ) {
  2.  
  3. var natives = tracksBy[ index ]._natives;
  4.  
  5. if ( !natives ||
  6. ( !!Popcorn.registryByName[ natives.type ] || !!obj[ natives.type ] ) ) {
  7. return true;
  8. }
  9. return false;
  10. }
  11.  
  12. function isAllowed( obj, trackEvent, which, currentTime ) {
  13.  
  14. if ( trackEvent[ which ] > currentTime &&
  15. trackEvent._running === false &&
  16. obj.data.disabled.indexOf( trackEvent._natives.type ) === -1 ) {
  17.  
  18. return true;
  19. }
  20. return false;
  21. }
  22.  
  23. function playTrackEvent( obj, event, trackEvent, which, state ) {
  24.  
  25. var method;
  26.  
  27. if ( trackEvent._natives ) {
  28. method = trackEvent._natives[ which ];
  29.  
  30. trackEvent._running = state;
  31.  
  32. if ( method ) {
  33. method.call( obj, event, trackEvent );
  34. }
  35. }
  36.  
  37. return trackEvent;
  38. }
  39.  
  40. function playIfAllowed( opts ) {
  41. if ( isAllowed( opts.instance, opts.trackEvent, opts.which, opts.currentTime ) ) {
  42. playTrackEvent( opts.instance, opts.event, opts.trackEvent, opts.which, opts.state );
  43. }
  44. }
Add Comment
Please, Sign In to add comment