MacOS Video Player: changes
Revision 144193
Trev,
/* Example code using AVPlayerLayer for a custom player */ Tweak code
Newer edit
| @@ -564,14 +564,15 @@ | |||
| 564 | myPlayerItem := AVPlayerItem.alloc.initWithAsset(myAsset); | 564 | myPlayerItem := AVPlayerItem.alloc.initWithAsset(myAsset); |
| 565 | myPlayer := AVPlayer.alloc.initWithPlayerItem(myPlayerItem); | 565 | myPlayer := AVPlayer.alloc.initWithPlayerItem(myPlayerItem); |
| 566 | 566 | ||
| 567 | // Display media loading message | ||
| 568 | loadingLabel.caption := 'Loading ...'; // or set in the Object Inspector | ||
| 569 | loadingLabel.visible := True; // set to false in the Object Inspector | ||
| 570 | |||
| 571 | |||
| 567 | // Wait until status is known (while loading AVAsset media) | 572 | // Wait until status is known (while loading AVAsset media) |
| 568 | while(myPlayer.Status = AVPlayerStatusUnknown) | 573 | while(myPlayer.Status = AVPlayerStatusUnknown) |
| 569 | do | 574 | do |
| 570 | begin | ||
| 571 | loadingLabel.caption := 'Loading ...'; // or set in the Object Inspector | ||
| 572 | loadingLabel.visible := True; // set to false in the Object Inspector | ||
| 573 | application.processmessages; | 575 | application.processmessages; |
| 574 | end; | ||
| 575 | 576 | ||
| 576 | loadingLabel.visible := False; // hide label now media loaded | 577 | loadingLabel.visible := False; // hide label now media loaded |
| 577 | 578 | ||
| @@ -655,7 +656,8 @@ | |||
| 655 | // release created objects | 656 | // release created objects |
| 656 | myAsset.release; | 657 | myAsset.release; |
| 657 | myPlayerItem.release; | 658 | myPlayerItem.release; |
| 658 | myPlayer.release; | 659 | myPlayer.release; |
| 660 | |||
| 659 | end. | 661 | end. |
| 660 | ``` | 662 | ``` |
| 661 | 663 | ||