macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

isPlaying

ムービーが再生中か返します

解説

ムービーが再生中か返します。
再生中ならYESを返します。
10.5以降はQTKitを使ってください。

返り値

( BOOL )

YES/NO

引数

フレームワーク

ApplicationKit

クラス

NSMovieView

Instance Methods

使用可能

10.0

参照

- start:
- stop:

例文

if ([movieViewObject isPlaying]){
}
/////
#import "MyObject.h"
//myOutletはMovieView
@implementation MyObject
- (IBAction)act:(id)sender;//アクション
{
    if([myOutlet isPlaying]){
    NSLog(@"YES");
    }else{
    NSLog(@"NO");
    }
}
- (IBAction)setMov:(id)sender//ムービーをセット
{
    //開けるファイル拡張子の配列
    NSArray      *imgTypes    = [ NSArray arrayWithObjects : @"mov",@"movie",nil ];
    //OpenPanelを作る
    NSOpenPanel  *opPanel       = [ NSOpenPanel openPanel ];
    //OpenPanelの結果のボタン番号
    int		  opRet;
    //ムービーのURL
    NSURL *movUrl ;
    //ムービー
    NSMovie *theMovie;

        //OpenPanelでファイル選択   
    opRet = [ opPanel runModalForDirectory : NSHomeDirectory() //どこのディレクトリを出すか
                                     file : @"Movies" //どのどのファイルを選択しておくか
                                    types : imgTypes ];//選べるファイルタイプ

    if ( opRet == NSOKButton ) {  // OPENPanelのボタンがOKなら
        //NSImageを作ってファイルから読み込む
        movUrl = [NSURL fileURLWithPath:[ opPanel filename ]];
        theMovie = [[NSMovie alloc] initWithURL:movUrl byReference:YES];
        [myOutlet setMovie:theMovie];
            }
}

@end