Giter Club home page Giter Club logo

opentok-ios-sdk-samples-swift's Introduction

Build Status

OpenTok iOS SDK Samples

This repository is meant to provide some examples for you to better understand the features of the OpenTok iOS SDK. The sample applications are meant to be used with the latest version of the OpenTok iOS SDK. Feel free to copy and modify the source code herein for your own projects. Please consider sharing your modifications with us, especially if they might benefit other developers using the OpenTok iOS SDK. See the License for more information.

Quick Start

  1. Get values for your OpenTok API key, session ID, and token. See Obtaining OpenTok Credentials for important information.

  2. Install CocoaPods as described in CocoaPods Getting Started.

  3. In Terminal, cd to your project directory and type pod install.

  4. Reopen your project in Xcode using the new .xcworkspace file.

  5. In the ViewController.swift file, replace the following empty strings with the corresponding API key, session ID, and token values:

    // *** Fill the following variables using your own Project info  ***
    // ***            https://tokbox.com/account/#/                  ***
    // Replace with your OpenTok API key
    let kApiKey = ""
    // Replace with your generated session ID
    let kSessionId = ""
    // Replace with your generated token
    let kToken = ""
  6. Use Xcode to build and run the app on an iOS simulator or device.

What's Inside

Basic Video Chat -- This basic application demonstrates a short path to getting started with the OpenTok iOS SDK.

Custom Audio Driver -- This project demonstrate how to use an external audio source with the OpenTok SDK. This project utilizes CoreAudio and the AUGraph API to create an audio session suitable for voice and video communications.

Custom Video Driver -- This project provides classes that implement the OTVideoCapture and OTVideoRender interfaces of the core Publisher and Subscriber classes. Using these modules, we can see the basic workflow of sourcing video frames from the device camera in and out of OpenTok, via the OTPublisherKit and OTSubscriberKit interfaces.

Live Photo Capture -- This project extends the video capture module implemented in project 2, and demonstrates how the AVFoundation media capture APIs can be used to simultaneously stream video and capture high-resolution photos from the same camera.

Screen Sharing -- This project demonstrates how to use a custom video capturer to publish a stream that uses a UI view (instead of a camera) as the video source.

Simple Multiparty -- This project demonstrates how to use the OpenTok iOS SDK for a multi-party call. The application publishes audio/video from an iOS device and can connect to multiple subscribers. However it shows only one subscriber video at a time due to CPU limitations on iOS devices.

FrameMetadata -- This project shows how to set metadata (limited to 32 bytes) to a video frame, as well as how to read metadata from a video frame.

Obtaining OpenTok Credentials

To use the OpenTok platform you need a session ID, token, and API key. You can get these values by creating a project on your OpenTok Account Page and scrolling down to the Project Tools section of your Project page. For production deployment, you must generate the session ID and token values using one of the OpenTok Server SDKs.

Development and Contributing

Interested in contributing? We ❤️ pull requests! See the Contribution guidelines.

Getting Help

We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:

Further Reading

opentok-ios-sdk-samples-swift's People

Contributors

abdulajet avatar chetanvangaditokbox avatar devwithzachary avatar goncalocostamendes avatar igitgotit avatar iujielim avatar jeffswartz avatar jvalli avatar kmoulder avatar lucashuang0802 avatar mheap avatar michaeljolley avatar msach22 avatar oludemilade avatar pardel avatar pvenum avatar robjperez avatar tnas32 avatar v-kpheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opentok-ios-sdk-samples-swift's Issues

Not able to see subscriber videos

Using Publisher token I can able to see only publisher video.
How can I see the subscriber's(who are using subscriber token but the same session id) video who connected with the same session with Publisher?

Not able to see camera preview after stopping screen-sharing.

Hi,

I have made a demo in which Video Call and also there is an option to share the screen.

I have taken the global variable of a publisher.

For starting screen sharing, I used below code.

func setupScreenSharing() {
       publisher.videoType = .screen
       publisher.audioFallbackEnabled = false
       
       capturer = ScreenCapturer(withView: view)
       publisher.videoCapture = capturer
   }

To stop screen sharing, and a setback to the camera, I used below code.

func resetVideoCallSettings() {
        publisher.videoCapture?.releaseCapture()
        capturer?.stop()
        publisher.videoType = .camera
        publisher.audioFallbackEnabled = false
        publisher.publishVideo = true
        publisher.publishAudio = true
        publisher.cameraPosition = .front
      }

But not getting any success, please let me know what I did wrong.

Thanks.

Multiple custom audio

I am developing an app in which I need to send 2 audio stream: the default one and a custom. My custom source is a Bluetooth device for which I get int16 on a 8kHz sample rate.

My first guess would have been to use two subscribers and to use the custom audio driver for my custom source but it appears not to be feasible.

My questions are:

  • is this feature by any luck on opentok roadmap?
  • if not is it possible to send a stereo sound, on the 1st channel the default source, on the 2nd the custom source and then subscribe twice, one subscribers
    reading the first channel and the second reading the second (this way subscribers can mute one or another signal?

Opentok Carthage Support

Hello,

my company have a paid account for Opentok and we want to build an app for iOS using your framework. As I usually only work with Carthage and don't use CocoaPods I am curious if you support Carthage too.

Swift 4 support

Hi, are there any plans on supporting Swift 4 in the near future? Thank you.

OTVideoCaptureConsumer consumeFrame crash

I am �using your library into our project. I am facing a critical bug relates to consumeFrame function of OTVideoCaptureConsumer. My flow:

  1. Create a custom VideoCapture
  2. Use GPUImage to filter camera, the camera object of GPUImage has a delegate func didCaptureBuffer(_ sampleBuffer: CMSampleBuffer) {...}
  3. In delegate func didCaptureBuffer, I implement addPointer for videoFrame.planes
  4. After addPointer for videoFrame.planes, I call consumeFrame from videoCaptureConsumer. This causes a crash.

Please give me a solution to fix this bug. Thank you so much!

P/s: I attached a error message
screen shot 2018-06-13 at 5 34 39 pm
below.

Portrait Video zoomed

The published video from the device is kind of zoomed - but only in portrait mode. Is there a way to keep the ratio of the landscape mode when publishing in portrait?

Is it possible to access both mics simultanesouly using the custom audio driver code?

Hello,

I am looking for ways to access the audio data from two or more mics on the iphone simultaneously. I came across the custom audio driver xcode project here. Is it possible to write an audio driver by modifying the custom audio driver code with which we can access audio data from 2 or more mics simultaneously on the iphone? Please let me know. I have looked at the custom audio driver code and the number of channels are mentioned as 1. Is it possible to label it as 2 and write some code to access multiple mic data at once..?

Subscriber Audio not able to listen

Hi ,
publisher and subscriber are connected to a session, subscriber can able to hear the publisher voice, but subscriber voice not able to here by publisher,please provide the solution for this,i was using 2.16.2 OpenTok Sdk.

Thanks
Prakash

Simple-Multiparty sample fails to load on XCode 9.0.1

Got this stack trace when running the sample application:

2017-10-22 11:49:29.134706+1100 Simple-Multiparty[26744:1225014] Unknown class _TtC19__Simple_Multiparty14ViewController in Interface Builder file.
2017-10-22 11:49:29.293398+1100 Simple-Multiparty[26744:1225014] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7fbcd0408930> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key collectionView.'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000106fb81cb __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x000000010acc4f41 objc_exception_throw + 48
	2   CoreFoundation                      0x0000000106fb8119 -[NSException raise] + 9
	3   Foundation                          0x0000000107def1e3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
	4   UIKit                               0x000000010894541f -[UIViewController setValue:forKey:] + 87
	5   UIKit                               0x0000000108c349dd -[UIRuntimeOutletConnection connect] + 109
	6   CoreFoundation                      0x0000000106f5b57d -[NSArray makeObjectsPerformSelector:] + 317
	7   UIKit                               0x0000000108c33393 -[UINib instantiateWithOwner:options:] + 1856
	8   UIKit                               0x000000010894c4e0 -[UIViewController _loadViewFromNibNamed:bundle:] + 383
	9   UIKit                               0x000000010894ce0c -[UIViewController loadView] + 177
	10  UIKit                               0x000000010894d13d -[UIViewController loadViewIfRequired] + 195
	11  UIKit                               0x000000010894d99a -[UIViewController view] + 27
	12  UIKit                               0x000000010881bae3 -[UIWindow addRootViewControllerViewIfPossible] + 122
	13  UIKit                               0x000000010881c1eb -[UIWindow _setHidden:forced:] + 294
	14  UIKit                               0x000000010882f098 -[UIWindow makeKeyAndVisible] + 42
	15  UIKit                               0x00000001087a1521 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4711
	16  UIKit                               0x00000001087a6751 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
	17  UIKit                               0x0000000108b6be00 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
	18  UIKit                               0x0000000108f3e840 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
	19  UIKit                               0x0000000108b6b9f9 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
	20  UIKit                               0x0000000108b6c257 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 668
	21  UIKit                               0x00000001094dfdd9 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
	22  UIKit                               0x00000001094dfc92 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
	23  UIKit                               0x00000001091c187e __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 420
	24  UIKit                               0x00000001093bee8e _performActionsWithDelayForTransitionContext + 100
	25  UIKit                               0x00000001091c167a -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
	26  UIKit                               0x0000000108f3de9d -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
	27  UIKit                               0x00000001087a4fd2 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
	28  UIKit                               0x0000000108d7989b -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
	29  FrontBoardServices                  0x0000000111ea21b4 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
	30  FrontBoardServices                  0x0000000111eaaca9 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
	31  libdispatch.dylib                   0x000000010ca6343c _dispatch_client_callout + 8
	32  libdispatch.dylib                   0x000000010ca68af4 _dispatch_block_invoke_direct + 592
	33  FrontBoardServices                  0x0000000111ed66ce __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
	34  FrontBoardServices                  0x0000000111ed6384 -[FBSSerialQueue _performNext] + 464
	35  FrontBoardServices                  0x0000000111ed68f3 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
	36  CoreFoundation                      0x0000000106f5b2b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	37  CoreFoundation                      0x0000000106ffad31 __CFRunLoopDoSource0 + 81
	38  CoreFoundation                      0x0000000106f3fc19 __CFRunLoopDoSources0 + 185
	39  CoreFoundation                      0x0000000106f3f1ff __CFRunLoopRun + 1279
	40  CoreFoundation                      0x0000000106f3ea89 CFRunLoopRunSpecific + 409
	41  GraphicsServices                    0x000000010e5b49c6 GSEventRunModal + 62
	42  UIKit                               0x00000001087a823c UIApplicationMain + 159
	43  Simple-Multiparty                   0x000000010560f397 main + 55
	44  libdyld.dylib                       0x000000010cadfd81 start + 1
	45  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Changing the module from __Simple__Multiparty to Simple__Multiparty in the View Controller of the main storyboard seemed to fix the issue.

image

I'm not very savvy with XCode but hopefully this helps someone else!
Cheers, Nigel

Problem while switching between basic Capturer to Custom Capturer.

Hi,

I have added the AR node which displays the Subscriber live video feed whenever user switches the camera to the front.

Initially, the publisher and Subscriber are not assigned to any Custom Capturer and Renderer. When the user switches the Camera to the front at that time, initializing the SCNViewVideoCapture and OpenTokMetalVideoRender and then assign it to Publisher's videoCapture and Subscriber's videoRender respectively.

subscriber.videoRender = OpenTokMetalVideoRender(node)
publisher.videoCapture = SCNViewVideoCapture(sceneView: scene)

This is working fine on the Publisher side (One who switch the Camera to front) but for the other person getting a blurry publisher video.

This happens only when I try to switch Capturer on a live session. if I initialize the publisher with custom video Capturer that time it is working fine.

I even tried to unpublish and re-publish with a new instance which is also leading to the same problem.

Orientation issues

I have contacted tokbox support a couple of times with a sample app demonstrating this problem but the support seems to be very slow. I'll try posting on here to see if I can reach out to the developers, as this is becoming an urgent problem.

Essentially, version 2.14.2 of OpenTok was the last version to correctly update the videoDimensions property of a stream that you're subscribed to. Ever since then, the videoDimensions for the stream have been incorrect. For this reason I cannot reliably upgrade my OpenTok version. Please can someone fix this?

I have attached a modified version of the Simple-Multiparty sample code. Please install pods. Also try installing with version 2.14.2 and see the difference in console logs! Here are the instructions:

  1. Have two devices streaming to each other in the session, and make sure they’re both subscribed to each other and the streams have been created.
  2. Rotate one device and look at the value of the videoDimensions printed out in the logs. Every time you rotate the device, the dimensions of the stream will always be the same. This should not happen, the width and height values should change based on the rotation of the device.

An example log should look like this:

video dimensions of stream changed to Optional([__C.NSKeyValueChangeKey(_rawValue: kind): 1, __C.NSKeyValueChangeKey(_rawValue: new): NSSize: {720, 1280}])

opentok-ios-sdk-samples-swift-master-3.zip

Cannot publish

I use OpenTok version 2.14.2, Xcode 10 and run the application on iPhone X (iOS 12.0)
I got error message "[avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Speaker (type: Speaker)"
So that cannot puslisk

Subscriber and Publisher should have weak delegate property

Right now, if the object (most commonly a ViewController) is the delegate of these Subscribers and Publisher, and keeps the reference to these subscribers and publisher, will be strongly referenced, hence a retain cycle.

The fix here is for the implementor to manually call disconnect.
Is there a cleaner way to handle this? Does these delegate reference needs to be held strongly?

iOS OpenTok sdk crashed, when receive signal from OpenTok Rest Api or OpenTok server sdk

Hi all.

We develop mobile application with OpenTok sdk.
Always keep sdk up to date. ( Now we are using OpenTok 2.15.2 )
2-way and group calls work good.
Also we use signaling API between clients in session. It also work good.

But recently we added functionality: "Sending a signal from your app server to connected clients" like it described in documentation: https://tokbox.com/developer/rest/#send_signal
We use method without connectionID, like it desribed in chapter "Signal all clients connected to the session"
UPD: The same issue for sendings singnals from server sdk
UPD The same issue if we send signal with connectionID parameter

If we post signal from server to mobile client -> the mobile app is crashed in OpenTok client sdk.

Logs from mobile client:

[ERROR] raptor_message_v2.cpp:272 - connection object does not exist or is not an object

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithUTF8String:]: NULL cString'
*** First throw call stack:
(0x1863de364 0x185624528 0x1863de2ac 0x186ccfa0c 0x10309cfb8 0x10357c0fc 0x1035a5294 0x103541944 0x103542ca0 0x10359b9e4 0x103552110 0x1035b3fcc 0x1035899b0 0x10356aa14 0x1035b8f34 0x1035b4ccc 0x10356b5d4 0x103538650 0x1860042b4 0x186004180 0x186002b74)
libc++abi.dylib: terminating with uncaught exception of type NSException


As far as I can see, crash in parsing signal method in sdk.
I also attached stack trace of crash from Crashlytics.
openTokCrash_stack_trace.txt

As you can see crash appear in OpenTok SDK, not in out mobile code.

Looking forward to hearing from you.

UPD Looks like the same issue was on Android sdk.
There is release notes for Android client SDK Version 2.14.3 (August 2018)
This version fixes the following issues:
Apps crash upon receiving a signal sent using the OpenTok REST API or the OpenTok server SDKs.

Not able to `consumeFrame` from iOS Broadcast Extension

I've successfully incorporated the latest version (v. 2.15.1.6758-ios) of OpenTok.framework into my test iOS Broadcast Extension (extension uses ReplayKit 2.0 and RPBroadcastSampleHandler class: https://developer.apple.com/documentation/replaykit/rpbroadcastsamplehandler).

However, any attempts to send any frames (not only the ones generated iOS system broadcast stream, but any frame, even the ones generated using static images from local resources) to the other testing device, using OpenTok SDK, fail, due to black view in the publisher view on the other device.

In the broadcast extension, I have used the sample code for implementing a custom video capturer (conforming to OpenTok's OTVideoCapture protocol), provided by OpenTok: https://github.com/opentok/opentok-ios-sdk-samples/tree/master/Screen-Sharing .

One quite important note here: After creating a custom video capturer, I was able to transfer frames manually to the receiving device, BUT it's working only in the iOS app. Exactly the same code does not work when executed in iOS app extension (although OpenTok session is properly initialized and working as expected). I've also debugged both situations and seems like the arguments' values passed to OpenTok SDK prior sending the frame are the same (between iOS app execution and iOS app extension execution), so it clearly suggests an issue in OpenTok SDK in the scenario of invoking its APIs from iOS app extension (specifically: videoCaptureConsumer.consumeFrame(:) API).

Question: Has OpenTok.framework been tested in the scenario of running within iOS Broadcast Extension? If yes, can you please provide any working sample code?

Crash on Basic Video Chat

Upon running the Basic Video chat, the application crash with Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)

#0 0x000000010072ab38 in -[OTMTLVideoRenderer setupTexturesForFrame:] ()
Screenshot 2019-11-21 at 3 23 59 AM

Crash using BlueTooth headset

Crashes at line 276: estimatedCaptureDelay
Tested on: iPhone 6/iOS 9.3.5 and iPhone 7+/iOS 10.3.1
Bluetooth devices tested: Jaybird X and Big Jambox

Also, audio quality on bluetooth is horrible ... sounds like it's 8 bit audio. The same quality issue is true in the Objective C example.

3. Custom Audio Driver doesn't work

Tested this with subscribeToSelf = true and false, and neither works. It would seem the subscriber never joins the session, presumably because the audioDevice never completes getting setup. When switching back to the Objective-C version of this it works no problem.

Screen-Sharing Feature use huge memory

I integrated my project with opentok by using call and screen-sharing feature. Your ScreenCapture.swift class has many issues of screen capture. It reverse and also memory keep increasing until App crash.

Multiparty UICollectionView Sample App not responding to orientation while session is active

In Multiparty UICollectionView, we've noticed that if you go from portrait to landscape or landscape to portrait during a session the child views do not respond accurately, it remains cut off at the bottom. The screen flips but the views do not, is there a way to fix this? We also noticed that sometimes the landscape views crop off the top and bottom of the feeds.

Destroyed stream when one participant joins the session after being in background mode.

This is based on https://stackoverflow.com/questions/51391291/opentok-ios-best-practice-to-start-a-video-chat-when-one-participant-has-the/51432279#51432279

We have Participant A and Participant B.

A triggers sessionDidConnect
A triggers session streamCreated
A pauses the app. The app is running in background
B triggers sessionDidConnect
B triggers session streamCreated
When A brings the app to foreground, then the connection and stream get destroyed. I would like to understand what we are doing wrong.

When is the best moment to call the following methods?

session.publish(publisher, ...)
session.subscribe(subscriber, ...)

I followed your documentation from tokbox.com/developer/sdks/ios/background-state.html when I initially set up the SDK and everything seems ok.

Streaming audio from a custom generated signal.

Let's see the following snippet that gets called instead of the AudioUnit callback for recording:

// We use AudioKit for demo purposes. 
let oscillator = AKOscillator() // Create a random endless sound of certain frecuency and amplitude 
oscillator.amplitude = random(in: 0.5...0.7) 
oscillator.frequency = random(in: 220...400) 
let mixer = AKMixer(oscillator) 
AudioKit.output = mixer // We check that actually we hear the sound 
let tap = AKLazyTap(node: mixer.avAudioNode) // Let's take some amount of sound in the node and pass it to a buffer 
guard let buffer = AVAudioPCMBuffer(pcmFormat: mixer.avAudioNode.outputFormat(forBus: 0), frameCapacity: 48000) else { return } // Create a buffer out of it 
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { _ in 
    tap?.fillNextBuffer(buffer, timeStamp: nil) // We fill the AudioPCMBuffer 
    if buffer.frameLength == 0 { return } // Check if there's something in the buffer 
   OpenTokManager
   .shared  
   .audioDevice.deviceAudioBus?
   .writeCaptureData(
      buffer.audioBufferList.pointee.mBuffers.mData!, 
      numberOfSamples: UInt32(buffer.frameLength)
   ) 
}

On the other side, the render side nothing is changed from the example project using the custom audio driver, we just render to the speakers as is it by default in the bus, the callback gets correctly called but nothing is rendered in the speaker.

Is there something that am I doing wrong? My main goal is to be able to stream my custom buffer through the stream and be able to hear it on the other side. All the roles are correctly being set, one is the publisher and the rest are subscribers.

Can not get data from the 'subscriber'

By using Basic video chat example, I tried to create a session between the web browser and the app. Data from the publisher(mobile) can be seen on the browser but subscriber data does not appear on the app.

In order not to use the mobile as subscriber also, I changed 'subscribeToSelf' value as 'false'. In this case, it does not reaches to the 'subscriberDidConnect' function.

I'll be glad if you can show me a way to make the app recognize browser as subscriber.

OpenTok publisher's view becomes black when application enters in foreground

In my one to one video calling app using OpenTok, the publisher's view becomes black after it goes to background mode and enters foreground. The subscriber is also not able to see the view(only seeing black box).

I am setting the publisher and subscriber properties as such:

publisher.publishVideo = true
subscriber.subscribeToVideo = true

Any solution will be very helpful.

55: EXCEPTION (-1): "" when writing to an audio session.

I'm currently writing capture data from a sample of 48000hz sin signal just for testing purposes. When I start to send the audio packets as they come from BLE and decompressed to have the same format as TokBox (1 channel, 48000hz, 16bit signed integer) I start to get the following error:

2019-09-06 15:14:30.609207+0200 ElluListenerExample[570:47449] [aid] AudioIssueDetectorNode.cpp:161:Initialize: Caught analyzer graph exception 1718775073 !mrf slice duration must be set before configure. in /BuildRoot/Library/Caches/com.apple.xbs/Sources/AudioDSP/AudioDSP-251.70.4.1/CoreAudioUtility/Source/CADSP/DSPGraph/DSPGraph_Graph.cpp:597 2019-09-06 15:14:30.663720+0200 ElluListenerExample[570:47505] 55: EXCEPTION (-1): ""

And shortly after the application crashes.
The code to inject the audio is pretty straightforward:


dispatch_async(dispatch_get_main_queue(), ^{
[manager.audioDevice.deviceAudioBus writeCaptureData: ioData->mBuffers[0].mData numberOfSamples:inNumberFrames];
});

Any idea of what is crashing inside the framework?

ExampleVideoCapture tilts in the wrong direction for front camera

In the custom video driver example, if you slightly rotate the camera, the video is tilted in the wrong direction when using the front camera. Switching to the back camera makes the preview layer rotate correctly.

The tilt I am talking about is what the layer does to mitigate device tilt until the UI finally rotates completely.

Basic Video Chat

When I publish a stream, I see two video views on my iOS device, but I am only publishing once stream (as expected). While that happens, if I publish from second device, I'm unable to see that stream on the first device.

Switching camera in 2.Custom-Video-Driver

Hi,
it seems that the ExampleVideoCapture.swift always uses the front camera - hard coded. What would we need to change so that setting publisher.cameraPosition would have an effect like with the framework classes?
Thanks!

Unable to mute video

hi, i have a problem when i try to lower the volume to mute
im unable to do it, the min level is 1 point
and the audio is still audible

MobileGestaltSupport.m does not have sandbox access (and other messages)

I'm using iPhone 5S, iOS 10.3, Xcode 8.3, OpenTok SDK 2.10.1: in all samples (1 - 6), the following messages appear on the console:

MobileGestaltSupport.m:153: pid 488 (1.Hello-World) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-04-04 06:46:48.528310+0300 1.Hello-World[488:50983] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see rdar://problem/11744455)
2017-04-04 06:46:48.560559+0300 1.Hello-World[488:50983] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-04-04 06:46:48.562338+0300 1.Hello-World[488:50983] [MC] Reading from public effective user settings.

Error reseting AVAudioSession

Hi,
The DefaultAudioDevice provided by the Custom Audio Driver project print "Error reseting AVAudioSession" and crash at line 311 after a call to session.disconnect(nil).

How to change TokBox audio volume programmatically?

Hi all!

We use ios openTok sdk for our app.
We have requirement to change audio volume on tokbox session programmatically using slider for changing volume.
Are there any ways to do this? I can't find any OTSubscriber, OTSession, OTPublisher and other classes interfaces which allow me to do this.
Help please.

help with swift 4

hi after ugrading to swift 4 i see this error in
VideoCaputre.swift

Expression pattern of type 'AVCaptureSession.Preset' cannot match values of type 'String'

in extension String {
func dimensionForCapturePreset() -> (width: UInt32, height: UInt32) {

can you help?

Seeing "55: EXCEPTION (-1)" logged repeatedly when using Custom Audio Driver example.

I've imported DefaultAudioDevice.swift into my app and am calling:

OTAudioDeviceManager.setAudioDevice(DefaultAudioDevice.sharedInstance)

When I connect to a session I repeatedly see an exception in the logs:

2017-10-24 15:22:05.606077-0400 Anchor[6321:1328636] 55: EXCEPTION (-1): ""
2017-10-24 15:22:05.615786-0400 Anchor[6321:1328636] 55: EXCEPTION (-1): ""
2017-10-24 15:22:05.628220-0400 Anchor[6321:1328636] 55: EXCEPTION (-1): ""

'consumeFrame' crashes when using a modified pixel buffer

Hi, I have taken the Custom-Video-Driver example project and updated it to Swift 4.2. Then I tried taking the image buffer, modifying it (using Vision and Core Image), then return it for consumption by OpenTok. However, every time I try to do so, I get the error on the first frame:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSConcretePointerArray pointerAtIndex:]: attempt to access pointer at index 1 beyond bounds 1'

Here is my code:

 func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
    if !capturing || videoCaptureConsumer == nil {
        return
    }
    
    guard let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer)
        else {
            print("Error acquiring sample buffer")
            return
    }
            
    guard let videoInput = videoInput
        else {
            print("Capturer does not have a valid input")
            return
    }
    
    let time = CMSampleBufferGetPresentationTimeStamp(sampleBuffer)
    
    videoFrame.timestamp = time
    let height = UInt32(CVPixelBufferGetHeight(imageBuffer))
    let width = UInt32(CVPixelBufferGetWidth(imageBuffer))
    
    if width != captureWidth || height != captureHeight {
        updateCaptureFormat(width: width, height: height)
    }
       
    guard let finalImage = makeBigEyes(imageBuffer) else { return }
    
    CVPixelBufferLockBaseAddress(finalImage, CVPixelBufferLockFlags(rawValue: 0))
    
    videoFrame.format?.estimatedCaptureDelay = 10
    videoFrame.orientation = .left
    
    videoFrame.clearPlanes()
    videoFrame.planes?.addPointer(CVPixelBufferGetBaseAddress(finalImage))
    
    delegate?.finishPreparingFrame(videoFrame)
    
    videoCaptureConsumer!.consumeFrame(videoFrame)
    
    CVPixelBufferUnlockBaseAddress(finalImage, CVPixelBufferLockFlags(rawValue: 0))
}

I am wondering if this is an OpenTok API issue or my own. I've tried many things but don't quite get the error. Why is it it trying to access index 1 on the first frame?

Adding video chat UI and related methods (Swift)

Hi Rob, I stumbled upon your project in swift via opentok ios sdk samples. I'm integrating opentok video chat in my swift project. I was able to successfully do so using this sample project. I wanted to add video chat UI and related methods in swift i.e. volume/ mute and flip camera buttons. While looking thru ios sdk samples in objective-c, it's unclear what methods are related to this functionality. How can I add this functionality to my swift project? Your input would be much appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.