Post

Replies

Boosts

Views

Activity

AVAsset and HLS Streaming
I try to play a m3u8 file and a mp3 file simultaneously. but it is not working. NSURL *audioURL = [NSURL URLWithString:@"https://***.mp3"]; AVAsset *audioAsset = [AVAsset assetWithURL:audioURL]; NSURL *videoURL = [NSURL URLWithString:@"https://***.m3u8"]; AVAsset *videoAsset = [AVAsset assetWithURL:videoURL]; NSError *error; AVMutableComposition* mixAsset = [[AVMutableComposition alloc] init]; AVMutableCompositionTrack* audioTrack = [mixAsset addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid]; [audioTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, audioAsset.duration) ofTrack:[[audioAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0] atTime:kCMTimeZero error: &error]; AVMutableCompositionTrack* videoTrack = [mixAsset addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid]; [videoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration) ofTrack:[[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] atTime:kCMTimeZero error: &error]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:mixAsset]; movie = [AVPlayer playerWithPlayerItem:playerItem];i get the following error:*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty arrayanother mp4 video file is working but not with m3u8 file (hls streaming). How is the right way to work with such files in a AVMutableCompositionTrack?
1
0
1.5k
Feb ’20
Trigger formTemplate Button from iPhone enter
I have a formTemplate and when the user starts typing, the keyboard opens on the iPhone for faster typing. How can I make the button in the formTemplate triggered by the iphone enter button? Is there any eventListener or similar? function emailTemplate() { var template = "<document><formTemplate><banner><description>Enter email for access</description></banner><textField id='email' keyboardType='emailAddress'>Your email</textField><footer><button><text>Submit</text></button></footer></formTemplate></document>"; // var parser = new DOMParser(); // var doc = parser.parseFromString(template , "application/xml"); var templateParser = new DOMParser(); var parsedTemplate = templateParser.parseFromString(template, "application/xml"); var loading = loadingTemplate(); loadingScreen); pushPage(parsedTemplate, loading); var email = parsedTemplate.getElementById("email"); parsedTemplate.addEventListener("select", function() { submit(email); }); } function submit(textField) { var keyboard = textField.getFeature('Keyboard'); var email = keyboard.text; if (isValidEmailAddress(email)) { localStorage.setItem("email", email); initPage(); } else { console.log("amail is not valid"); } }
1
0
695
Mar ’22