QuickTime video player for Cocoa
Re: QuickTime video player for Cocoa
The TouchBar shouldn't matter as the TouchBar items are automatically invoked if a TouchBar is available. If a TouchBar is not available it's not invoked.
Apparently a program with custom TouchBar items should even work on computers without TouchBar as long as macOS 10.12 is used.
Got a custom TouchBar coded with Objective C. It's pretty similar to the StatusBar.
Works nicely.
Thank you for all your input.
Apparently a program with custom TouchBar items should even work on computers without TouchBar as long as macOS 10.12 is used.
Got a custom TouchBar coded with Objective C. It's pretty similar to the StatusBar.
Works nicely.
Thank you for all your input.
I am to provide the public with beneficial shocks.
Alfred Hitshock
Re: QuickTime video player for Cocoa
Found out that it also works with NSApplicationMain; at least with local files.
Not sure why it doesn't work with remote files as:
is inside the plist file...
Really strange.
Not sure why it doesn't work with remote files as:
Code: Select all
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
Really strange.
I am to provide the public with beneficial shocks.
Alfred Hitshock
Re: QuickTime video player for Cocoa
It works now
The solution is to only add:
and leave NSAllowsArbitraryLoadsInWebContent out
Now remote videos are played.
Finally
BTW: NSApplicationMain works beautifully without a NIB
The solution is to only add:
Code: Select all
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Now remote videos are played.
Finally
BTW: NSApplicationMain works beautifully without a NIB
I am to provide the public with beneficial shocks.
Alfred Hitshock
Re: QuickTime video player for Cocoa
Hi Wilbert and Fsw,
Since QTKit/QTMovie (based on Quicktime 7, wich is 32 bits) is no more supported in MacOS 10.15 Catalina, i am trying to update my custom movie library with AVKit/AVFoundation.
I started using your code Wilbert, but i need to implement more functions like seeking into the video file.
I tryed with "seekToTime" like that but it does nothing :
Any idea ?
Since QTKit/QTMovie (based on Quicktime 7, wich is 32 bits) is no more supported in MacOS 10.15 Catalina, i am trying to update my custom movie library with AVKit/AVFoundation.
I started using your code Wilbert, but i need to implement more functions like seeking into the video file.
I tryed with "seekToTime" like that but it does nothing :
Code: Select all
Structure CMTime ;{
value.q ; Int64_t
timeScale.l ; Int32_t
flags.l ; UInt32_t
CMTimeEpoch.q ; Int64_t
EndStructure ;}
Define.CMTime time
Define.CMTime duration
CocoaMessage(@duration, CocoaMessage(0, CocoaMessage(0, *p\Player, "currentItem"), "asset"), "duration")
Debug "Duration = " + Int(duration\value * 1000 / duration\timeScale) ; Works OK !
time\timeScale = duration\timeScale
time\value = Value * time\timeScale / 1000
CocoaMessage(0, *p\Player, "seekToTime:@", @time)
Niffo
Re: QuickTime video player for Cocoa
Niffo wrote:Any idea ?
Code: Select all
#kCMTimeFlags_Valid = 1
Structure CMTime
value.q
timeScale.l
flags.l
CMTimeEpoch.q
EndStructure
; Move to 30 sec
time.CMTime
time\value = 30000
time\timeScale = 1000
time\flags = #kCMTimeFlags_Valid
CocoaMessage(0, Player, "seekToTime:@", @time)
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: QuickTime video player for Cocoa
For those who would be interested, here is how to :
- Play the media :
- Pause the media :
- Seek the media
- Get the original size of the media
- Change the media volume
- Get the media duration
- Free the media :
- Play the media :
Code: Select all
CocoaMessage(0, Player, "play")
Code: Select all
CocoaMessage(0, Player, "pause")
Code: Select all
Structure CMTime ;{
value.q ; Int64_t
timeScale.l ; Int32_t
flags.l ; UInt32_t
CMTimeEpoch.q ; Int64_t
EndStructure ;}
Define.CMTime time
CocoaMessage(@time, Player, "currentTime")
time\value = Value * time\timeScale / 1000
CocoaMessage(0, Player, "seekToTime:@", @time) ; To be knowed : seekToTime : parameters "toleranceBefore" and "toleranceAfter" can be set to "CMTimeZero" for higher accuracy
Code: Select all
Define.CGSize size
CocoaMessage(@size, CocoaMessage(0, CocoaMessage(0, Player, "currentItem"), "asset"), "naturalSize") ; Noted as deprecated in Apple docs, should use : CGSize size = [[[movieAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] naturalSize];
debug size\width
debug size\height
Code: Select all
Define.f Volume = Value / 100
CocoaMessage(0, Player, "setVolume:@", @Volume)
Code: Select all
Structure CMTime ;{
value.q ; Int64_t
timeScale.l ; Int32_t
flags.l ; UInt32_t
CMTimeEpoch.q ; Int64_t
EndStructure ;}
Define.CMTime duration
CocoaMessage(@duration, CocoaMessage(0, CocoaMessage(0, Player, "currentItem"), "asset"), "duration")
debug Int(duration\value * 1000 / duration\timeScale)
Code: Select all
CocoaMessage(0, PlayerView, "setPlayer:", #Null)
CocoaMessage(0, PlayerView, "release")
CocoaMessage(0, Player, "replaceCurrentItemWithPlayerItem:", #Null)
CocoaMessage(0, Player, "release")
Niffo
Re: QuickTime video player for Cocoa
It would be nice if PureBasic itself would be updated to use AVPlayer instead of QuickTime for the Movie library.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: QuickTime video player for Cocoa
+1
viewtopic.php?f=24&t=73941
... but not the time to wait and before that (few years), PB Movie library was not complete/stable. Do not know if it is stable now.
viewtopic.php?f=24&t=73941
... but not the time to wait and before that (few years), PB Movie library was not complete/stable. Do not know if it is stable now.
Niffo