search_openresult_inquicktime: Open a search result in 'Quicktime' (and play it)

View source: R/search_openresult_inquicktime.R

search_openresult_inquicktimeR Documentation

Open a search result in 'Quicktime' (and play it)

Description

The function remote controls 'Quicktime' by using an Apple Script. It opens a search result in 'Quicktime' and plays it.

Usage

search_openresult_inquicktime(
  x,
  s,
  resultNr,
  play = TRUE,
  closeAfterPlaying = FALSE,
  bringQuicktimeToFront = TRUE,
  filterFile = c(".*\\.(mp4|mov)", ".*\\.(aiff|aif|wav)", ".*\\.mp3")
)

Arguments

x

Corpus object.

s

Search object.

resultNr

Integer; Number of the search result (row in the data frame s@results) to be played.

play

Logical; If TRUE selection will be played.

closeAfterPlaying

Logical; if TRUE the Quicktime player will be closed after playing the cuts.

bringQuicktimeToFront

Logical; if TRUE the Quicktime player will be activated and placed before all other windows.

filterFile

Vector of character strings; Each element of the vector is a regular expression. Expressions will be checked consecutively. The first match with an existing media file will be used for playing. The default checking order is video > uncompressed audio > compressed audio.

Details

Note: You need to be on a Mac to use this function.

Span
If you want to extend the cut before or after each search result, you can modify @cuts.span.beforesec and @cuts.span.aftersec in your search object.

Value

Logical; TRUE if media file has been played, or FALSE if not.

Examples

library(act)

mysearch <- act::search_new(x=examplecorpus, pattern = "pero")

# You can only use this function if you are on a Mac.
# In addition, you need to have downloaded the example media. 
## Not run: 

# Assign media files
examplecorpus@paths.media.files <- c("FOLDERWHEREMEDIAFILESARELOCATED")
examplecorpus <- act::media_assign(examplecorpus)
	
# Play the media for the first search result
act::search_openresult_inquicktime(x=examplecorpus, 
s=mysearch, 
resultNr = 1,
play=TRUE,
closeAfterPlaying=TRUE)

# Play all search results after one another.
	for (i in 1:nrow(mysearch@results)) {
		print(mysearch@results$content[i])
		act::search_openresult_inquicktime(x=examplecorpus, 
s=mysearch, 
resultNr = i, 
play=TRUE,
closeAfterPlaying=TRUE)
	}

## End(Not run)

act documentation built on June 7, 2023, 6:16 p.m.